Skip to content

Commit f31a07b

Browse files
authored
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 2 additions & 3 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy