-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: correctly normalize mocked path, if file is named like the folder (
#1973) * fix: correctly normalize mocked path, if file is named like the folder * chore: cleanup
- Loading branch information
1 parent
f55fa26
commit 209ea6b
Showing
4 changed files
with
44 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const foo = 'foo' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
import { it } from 'vitest' | ||
import { expect, it, vi } from 'vitest' | ||
import { foo } from '../src' | ||
|
||
vi.mock('../src.ts', () => ({ foo: 'baz' })) | ||
|
||
it('should work', () => { | ||
// | ||
expect(1).toBe(1) | ||
}) | ||
|
||
it('mocking with root works', () => { | ||
expect(foo).toBe('baz') | ||
}) |