Skip to content

Commit

Permalink
feat!: don't reset modules with --no-isolate (#1754)
Browse files Browse the repository at this point in the history
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
  • Loading branch information
sheremet-va and antfu committed Sep 4, 2022
1 parent e393be3 commit 025f256
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/vitest/src/runtime/entry.ts
Expand Up @@ -47,8 +47,13 @@ export async function run(files: string[], config: ResolvedConfig): Promise<void

await withEnv(environment, config.environmentOptions || {}, async () => {
for (const file of files) {
workerState.mockMap.clear()
resetModules(workerState.moduleCache, true)
// it doesn't matter if running with --threads
// if running with --no-threads, we usually want to reset everything before running a test
// but we have --isolate option to disable this
if (config.isolate) {
workerState.mockMap.clear()
resetModules(workerState.moduleCache, true)
}

workerState.filepath = file

Expand Down

0 comments on commit 025f256

Please sign in to comment.