-
-
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: allow mocking CJS module with interoped default (#2598)
* fix: allow mocking CJS module with interoped default * chore: cleanup * chore: cleanup
- Loading branch information
1 parent
9a29f98
commit 6b3e36d
Showing
5 changed files
with
25 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = function () { | ||
return true | ||
} |
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,7 +1,14 @@ | ||
import '../src/external/external.mjs' | ||
import { expect, test, vi } from 'vitest' | ||
import axios from 'axios' | ||
import defaultFunc from '../src/external/default-function.cjs' | ||
|
||
vi.mock('../src/external/default-function.cjs') | ||
|
||
test('axios is mocked', () => { | ||
expect(vi.isMockFunction(axios.get)).toBe(true) | ||
}) | ||
|
||
test('defaultFunc is mocked', () => { | ||
expect(vi.isMockFunction(defaultFunc)).toBe(true) | ||
}) |
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