forked from wojtekmaj/react-datetime-picker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate from Jest to Vitest (wojtekmaj#314)
* Migrate from Jest to Vitest * Remove Jest shield
- Loading branch information
Showing
16 changed files
with
795 additions
and
3,074 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 |
---|---|---|
|
@@ -110,4 +110,4 @@ jobs: | |
HUSKY: 0 | ||
|
||
- name: Run tests | ||
run: yarn jest | ||
run: yarn unit |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
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,3 +1,4 @@ | ||
import { describe, expect, it } from 'vitest'; | ||
import { between } from './utils'; | ||
|
||
describe('between', () => { | ||
|
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,19 +1,19 @@ | ||
/* eslint-env jest */ | ||
import { vi } from 'vitest'; | ||
|
||
export function muteConsole() { | ||
jest.spyOn(global.console, 'log').mockImplementation(() => { | ||
vi.spyOn(global.console, 'log').mockImplementation(() => { | ||
// Intentionally empty | ||
}); | ||
jest.spyOn(global.console, 'error').mockImplementation(() => { | ||
vi.spyOn(global.console, 'error').mockImplementation(() => { | ||
// Intentionally empty | ||
}); | ||
jest.spyOn(global.console, 'warn').mockImplementation(() => { | ||
vi.spyOn(global.console, 'warn').mockImplementation(() => { | ||
// Intentionally empty | ||
}); | ||
} | ||
|
||
export function restoreConsole() { | ||
global.console.log.mockRestore(); | ||
global.console.error.mockRestore(); | ||
global.console.warn.mockRestore(); | ||
vi.mocked(global.console.log).mockRestore(); | ||
vi.mocked(global.console.error).mockRestore(); | ||
vi.mocked(global.console.warn).mockRestore(); | ||
} |
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,12 @@ | ||
// eslint-disable-next-line import/no-unresolved | ||
import { defineConfig } from 'vitest/config'; | ||
|
||
export default defineConfig({ | ||
test: { | ||
deps: { | ||
inline: ['vitest-canvas-mock'], | ||
}, | ||
environment: 'jsdom', | ||
setupFiles: 'vitest.setup.ts', | ||
}, | ||
}); |
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,10 @@ | ||
import { expect, afterEach } from 'vitest'; | ||
import { cleanup } from '@testing-library/react'; | ||
import matchers from '@testing-library/jest-dom/matchers'; | ||
import 'vitest-canvas-mock'; | ||
|
||
expect.extend(matchers); | ||
|
||
afterEach(() => { | ||
cleanup(); | ||
}); |
Oops, something went wrong.