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
Copy file name to clipboardExpand all lines: docs/api/advanced/plugin.md
+48Lines changed: 48 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -123,3 +123,51 @@ The project's `configFile` can be accessed in Vite's config: `project.vite.confi
123
123
124
124
Notethatthiswillalsoinheritthe`name`-Vitestdoesn't allow multiple projects with the same name, so this will throw an error. Make sure you specified a different name. You can access the current name via the `project.name` property and all used names are available in the `vitest.projects` array.
Vitest creates persistent file hash based on file content, its id, vite's environment configuration and coverage status. Vitest tries to use as much information it has about the configuration, but it is still incomplete. At the moment, it is not possible to track your plugin options because there is no standard interface for it.
30
+
31
+
If you have a plugin that relies on things outside the file content or the public configuration (like reading another file or a folder), it's possible that the cache will get stale. To workaround that, you can define a [cache key generator](/api/advanced/plugin#definecachekeygenerator) to specify dynamic option or to opt-out of caching for that module:
// cache this file based on the value of a dynamic variable
48
+
if (sourceCode.includes('myDynamicVar')) {
49
+
returnprocess.env.DYNAMIC_VAR_VALUE
50
+
}
51
+
})
52
+
}
53
+
}
54
+
],
55
+
test: {
56
+
experimental: {
57
+
fsModuleCache:true,
58
+
},
59
+
},
60
+
})
61
+
```
62
+
63
+
If you are a plugin author, consider defining a [cache key generator](/api/advanced/plugin#definecachekeygenerator) in your plugin if it can be registered with different options that affect the transform result.
By default, Vitest will try to find the workspace root and store the cache inside the `node_modules` folder. The root is based on your package manager's lockfile (for example, `.package-lock.json`, `.yarn-state.yml`, `.pnpm/lock.yaml` and so on).
73
+
74
+
At the moment, Vitest ignores the [test.cache.dir](/config/cache) or [cacheDir](https://vite.dev/config/shared-options#cachedir) options completely and creates a separate folder.
Copy file name to clipboardExpand all lines: docs/config/server.md
-22Lines changed: 0 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,25 +71,3 @@ If a `RegExp` is provided, it is matched against the full file path.
71
71
When a dependency is a valid ESM package, try to guess the cjs version based on the path. This might be helpful, if a dependency has the wrong ESM file.
72
72
73
73
This might potentially cause some misalignment if a package has different logic in ESM and CJS mode.
74
-
75
-
## debug
76
-
77
-
### dump
78
-
79
-
-**Type:**`string | boolean`
80
-
-**Default:**`false`
81
-
82
-
The folder where Vitest stores the contents of inlined test files that can be inspected manually.
83
-
84
-
If set to `true`, Vitest dumps the files inside the `.vitest-dump` folder relative to the root of the project.
85
-
86
-
You can also use `VITEST_DEBUG_DUMP` env variable to enable this conditionally.
87
-
88
-
### load
89
-
90
-
-**Type:**`boolean`
91
-
-**Default:**`false`
92
-
93
-
Read files from the dump instead of transforming them. If dump is disabled, this does nothing.
94
-
95
-
You can also use `VITEST_DEBUG_LOAD_DUMP` env variable to enable this conditionally.
Copy file name to clipboardExpand all lines: docs/guide/cli-generated.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -798,3 +798,16 @@ Use `bundle` to bundle the config with esbuild or `runner` (experimental) to pro
798
798
-**CLI:**`--standalone`
799
799
800
800
Start Vitest without running tests. Tests will be running only on change. This option is ignored when CLI file filters are passed. (default: `false`)
801
+
802
+
### clearCache
803
+
804
+
-**CLI:**`--clearCache`
805
+
806
+
Delete all Vitest caches, including `experimental.fsModuleCache`, without running any tests. This will reduce the performance in the subsequent test run.
0 commit comments