-
Notifications
You must be signed in to change notification settings - Fork 975
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(forms): switch tests to vitest (#9928)
~~In this case I have not explicitly imported the vitest functions as we have to enable globals for the third party testing libraries to work.~~ --------- Co-authored-by: Tobbe Lundberg <tobbe@tlundberg.com>
- Loading branch information
Showing
7 changed files
with
46 additions
and
32 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { defineConfig } from 'vitest/config' | ||
|
||
export default defineConfig({ | ||
test: { | ||
environment: 'jsdom', | ||
setupFiles: ['vitest.setup.mts'], | ||
}, | ||
}) |
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,11 @@ | ||
import { afterEach } from 'vitest' | ||
import { cleanup } from '@testing-library/react' | ||
import '@testing-library/jest-dom/vitest' | ||
|
||
afterEach(() => { | ||
// If vitest globals are enabled testing-library will clean up after each | ||
// test automatically, but we don't enable globals, so we have to manually | ||
// clean up here | ||
// https://testing-library.com/docs/react-testing-library/api/#cleanup | ||
cleanup() | ||
}) |
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