Skip to content

Commit 7320efa

Browse files
committed
chore: repro
1 parent 7715581 commit 7320efa

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

examples/repro-9290/test/short.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { expect, test, vi } from 'vitest'
22
import something from '../src/module'
33

44
// Using { spy: true } - this should collect coverage but currently doesn't
5-
vi.mock('../src/module', { spy: true })
5+
vi.mock(import('../src/module'), { spy: true })
66

77
test('should spy on module and collect coverage with spy: true', () => {
88
const result = something(5)

examples/repro-9290/test/verbose.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { expect, test, vi } from 'vitest'
22
import something from '../src/module'
33

44
// Manual spy approach - this DOES collect coverage
5-
vi.mock('../src/module', async () => {
6-
const actual = await vi.importActual<typeof import('../src/module')>('../src/module')
5+
vi.mock(import('../src/module'), async (importOriginal) => {
6+
const actual = await importOriginal()
77
return {
88
...actual,
99
default: vi.spyOn(actual, 'default'),

0 commit comments

Comments
 (0)