Skip to content

Commit f31a07b

Browse files
authoredFeb 13, 2025··
fix(coverage): preserve moduleExecutionInfo in non-isolated runs (#7486)
1 parent 5a45a7c commit f31a07b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed
 

‎packages/vitest/src/runtime/workers/base.ts

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { provideWorkerState } from '../utils'
77
let _viteNode: VitestExecutor
88

99
const moduleCache = new ModuleCacheMap()
10+
const moduleExecutionInfo = new Map()
1011

1112
async function startViteNode(options: ContextExecutorOptions) {
1213
if (_viteNode) {
@@ -21,6 +22,7 @@ export async function runBaseTests(method: 'run' | 'collect', state: WorkerGloba
2122
const { ctx } = state
2223
// state has new context, but we want to reuse existing ones
2324
state.moduleCache = moduleCache
25+
state.moduleExecutionInfo = moduleExecutionInfo
2426

2527
provideWorkerState(globalThis, state)
2628

‎test/coverage-test/test/isolation.test.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ for (const isolate of [true, false]) {
4848
if (isV8Provider()) {
4949
expect(summary).toStrictEqual({
5050
'<process-cwd>/fixtures/src/branch.ts': {
51-
// FIXME: this should specify exact numbers
52-
branches: expect.any(String),
53-
functions: expect.any(String),
51+
branches: '3/3 (100%)',
52+
functions: '1/1 (100%)',
5453
lines: '6/6 (100%)',
5554
statements: '6/6 (100%)',
5655
},

0 commit comments

Comments
 (0)