You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On upgrading to vitest@0.32.0 tests are unable to resolve sveltekit's environment module alias ($env). There is no error when running tests on vitest@0.31.4.
Is there something wrong in my configuration after upgrading to 0.32.0? No other changes were made in the linked repo aside from upgrading the vitest packages version.
FAIL src/routes/api/wakatime/current/summaries/server.spec.ts [ src/routes/api/wakatime/current/summaries/server.spec.ts ]
Error: Cannot find module '$env/static/private'.
- If you rely on tsconfig.json to resolve modules, please install "vite-tsconfig-paths" plugin to handle module resolution.
- Make sure you don't have relative aliases in your Vitest config. Use absolute paths instead. Read more: https://vitest.dev/guide/common-errors
❯ src/routes/api/wakatime/current/summaries/+server.ts:1:31
1| import { WAKA_API_KEY } from '$env/static/private'
| ^
2| import { BaseUrl, RestResource, WakaApiRange } from '$lib/constants'
3| import type { SummariesResult } from '$src/types/wakatime'
❯ src/routes/api/wakatime/current/summaries/server.spec.ts:2:31
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: {
"code": "ERR_MODULE_NOT_FOUND",
}
Describe the bug
On upgrading to
vitest@0.32.0
tests are unable to resolve sveltekit's environment module alias ($env). There is no error when running tests onvitest@0.31.4
.Is there something wrong in my configuration after upgrading to 0.32.0? No other changes were made in the linked repo aside from upgrading the vitest packages version.
Repository With Import Error:
https://github.com/cesarnml/waka-shortcut-time-stats/tree/cesar/vitest-0.32.0-sveltekit-bug
Main Branch runs on vitest 0.31.4 (no import error):
https://github.com/cesarnml/waka-shortcut-time-stats/tree/main
Reproduction
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: