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
Also – at least with the package setup – it seems like the file is preprocessed again, despite the statement from v0.34.0:
Custom environment now should be processed before Vitest can consume it. It means that you cannot specify a path to a TS file or use import paths that should be processed by Vite.
If this is indeed supported again and once this issue here has been addressed, could the documentation be updated to specify a path to a valid JS/TS file?
Describe the bug
The documentation at https://vitest.dev/guide/environment.html#custom-environment states that since v0.34.0 a custom environment can be a valid JS file (instead of a
vitest-environment-${name}
package).However, with a configuration like the following
it still tries to load the custom environment from a package:
MISSING DEP Can not find dependency 'vitest-environment-./custom.js'
The resolve logic seems to differentiate correctly here:
vitest/packages/vitest/src/integrations/env/index.ts
Lines 55 to 57 in 22181f0
So I'd guess there's an issue in the loader used at the next line:
vitest/packages/vitest/src/integrations/env/index.ts
Line 58 in 22181f0
Also – at least with the package setup – it seems like the file is preprocessed again, despite the statement from v0.34.0:
For example, a setup like this works fine: https://github.com/vitest-dev/vitest/blob/main/test/env-custom/vitest-environment-custom/package.json
Related to #4196?
If this is indeed supported again and once this issue here has been addressed, could the documentation be updated to
specify a path to a valid JS/TS file
?Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-uefbmr
System Info
System: OS: macOS 13.5.2 CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz Memory: 9.84 GB / 32.00 GB Shell: 5.2.15 - /usr/local/bin/bash Binaries: Node: 18.18.0 - /usr/local/opt/node@18/bin/node npm: 10.1.0 - /usr/local/bin/npm pnpm: 8.8.0 - /usr/local/bin/pnpm npmPackages: vitest: 0.34.6 => 0.34.6
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: