Skip to content

Commit 3934206

Browse files
committed
docs: rephrase viteModuleRunner docs
1 parent 9be6121 commit 3934206

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

docs/config/experimental.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ Controls whether Vitest uses Vite's [module runner](https://vite.dev/guide/api-e
207207

208208
If this option is defined in the root config, all [projects](/guide/projects) will inherit it automatically.
209209

210-
We recommend disabling the module runner if you are running tests in the same environment as your code (server backend or simple scripts, for example). However, we still recommend running `jsdom`/`happy-dom` tests with the module runner or in [the browser](/guide/browser/) since it doesn't require any additional configuration.
210+
Consider disabling the module runner if you are running tests in the same environment as your code (server backend or simple scripts, for example). However, we still recommend running `jsdom`/`happy-dom` tests with Vite's module runner or in [the browser](/guide/browser/) since it doesn't require any additional configuration.
211211

212212
Disabling this flag will disable _all_ file transforms:
213213

@@ -226,11 +226,11 @@ Also note that this option only works with `forks` or `threads` [pools](/config/
226226

227227
By default, Vitest runs tests in a very permissive module runner sandbox powered by Vite's [Environment API](https://vite.dev/guide/api-environment.html#environment-api). Every file is categorized as either an "inline" module or an "external" module.
228228

229-
Module runner runs all "inline" modules. It provides `import.meta.env`, `require`, `__dirname`, `__filename`, static `import`, and has its own module resolution mechanism. This makes it very easy to run code when you don't want to configure the environment and just need to test that the bare JavaScript logic you wrote works as intended.
229+
Module runner runs all "inlined" modules. It provides `import.meta.env`, `require`, `__dirname`, `__filename`, static `import`, and has its own module resolution mechanism. This makes it very easy to run code when you don't want to configure the environment and just need to test that the bare JavaScript logic you wrote works as intended.
230230

231231
All "external" modules run in native mode, meaning they are executed outside of the module runner sandbox. If you are running tests in Node.js, these files are imported with the native `import` keyword and processed by Node.js directly.
232232

233-
While running JSDOM/happy-dom tests in a permissive fake environment might be justified, running Node.js tests in a non-Node.js environment is counter-productive as it can hide and silence potential errors you may encounter in production, especially if your code doesn't require any additional transformations provided by Vite plugins.
233+
While running JSDOM/happy-dom tests in a permissive fake environment might be justified, running Node.js tests in a non-Node.js environment can hide and silence potential errors you may encounter in production, especially if your code doesn't require any additional transformations provided by Vite plugins.
234234

235235
### Known Limitations
236236

@@ -328,6 +328,7 @@ export default defineConfig({
328328
```
329329

330330
If you are running tests in Deno, TypeScript files are processed by the runtime without any additional configurations.
331+
:::
331332

332333
## experimental.nodeLoader <Version type="experimental">4.1.0</Version> {#experimental-nodeloader}
333334

0 commit comments

Comments
 (0)