Stabilizing viteModuleRunner
#9501
sheremet-va
started this conversation in
Feedback
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
experimental.viteModuleRunnerVitest has become popular with projects that do not use Vite in their pipeline and don't require any custom transformations of their files. With
--strip-typesbecoming the default in Node.js, we think it makes sense for Vitest to provide a way to opt-out of Vite's module runner and run tests natively (similar to how ava, mocha ornode:testwork).Disabling Vite's module runner has a lot of consequences. All transformations will be disabled, including aliases. Vitest won't automatically interop
defaultof ES modules (providingdefaultas a module namespace). All files will be processed natively by your runtime. The goal is to support any server runtime that supportsWorkerorchild_process.import.meta.env,require,__dirname,__filenamewill no longer be automatically injected into every file. (Note that we plan to introduce a separatestrictoption to disable this behaviour even in Vite's module runner). Module mocking and in-source tests still work and are implemented by using Node's sync module hooks - we want to support as many of Vitest's features as possible in this mode.This is an attempt to experiment and explore a more standard approach to running tests and reduce friction introduced by Vite's module runner.
Beta Was this translation helpful? Give feedback.
All reactions