mirror of
https://github.com/vitest-dev/vitest.git
synced 2026-02-01 17:36:51 +00:00
* feat!: rewrite how vite-node resolves id * chore: try to fix global setup test * fix: remove /@fs/ from filepath * chore: cleanup * fix: normalize id for callstack * fix: don't append "/" before disk drive on windows * chore: cleanup * chore: add test that windows drive is not repeated * fix: dirname uses \\, update windows paths tests * refactor: rename variables * fix: don't provide importer only for /@id/ * chore: remove null byte placeholder as part of unwrapRef * chore: cleanup * chore: variables renaming * fix: don't hang on circular mock * test: update c8 snapshot * chore: add compatibility layer for users who don't provide resolveId * test: fix url handling in web worker * test: fix file tests on windows * chore: remove unnecessary normalizations in mocker * chore: use /@fs/ when fetching module, if possible
14 lines
304 B
TypeScript
14 lines
304 B
TypeScript
import axios from 'axios'
|
|
|
|
test('mocked axios', async () => {
|
|
const { default: ax } = await vi.importMock<any>('axios')
|
|
|
|
await ax.get('string')
|
|
|
|
expect(ax.get).toHaveBeenCalledWith('string')
|
|
})
|
|
|
|
test('actual axios is not mocked', async () => {
|
|
expect(vi.isMockFunction(axios.get)).toBe(false)
|
|
})
|