BloxEZ
BloxEZ2mo ago

Deno Aliases

When I run my tests I get the following example error:
error: Relative import path "@services/chain/types/chain_types.ts" not prefixed with / or ./ or ../
at file:///workspaces/maicro/backend/test/1000.config.and.files/1000.config.test.ts:6:26
error: Relative import path "@services/chain/types/chain_types.ts" not prefixed with / or ./ or ../
at file:///workspaces/maicro/backend/test/1000.config.and.files/1000.config.test.ts:6:26
But my app runs, and deno check doesn't complain about any issues. imports from my deno.json
"imports": {
"zod": "npm:zod@^3.24.1",
"appwrite/": "npm:appwrite@^16.0.2/",
"@services/": "./services/",
"@common/": "./services/common/",
"@test_tools/": "./test/test_tools/"
}
"imports": {
"zod": "npm:zod@^3.24.1",
"appwrite/": "npm:appwrite@^16.0.2/",
"@services/": "./services/",
"@common/": "./services/common/",
"@test_tools/": "./test/test_tools/"
}
Screen snip attached showing when I am editing in code, no errors are indicated. The issues only start when I try to run tests that contain aliases. Any thoughts
No description
3 Replies
BloxEZ
BloxEZOP2mo ago
Deno Aliases causing errors in tests. I've done a bit more basic checking, using aliases in main.ts successfully. But when used in any test, that test fails with the error shown in the previous screen snip.
marvinh.
marvinh.2mo ago
Can you file an issue for that https://github.com/denoland/deno/issues ?
BloxEZ
BloxEZOP2mo ago
GitHub
Alias causes errors in tests · Issue #29916 · denoland/deno
Version: Deno latest I've setup aliases and my project runs fine. Deno check completes and reports no issues. Trying to run a test containing an issue reports errors of import not starting with ./

Did you find this page helpful?