-
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.
🛠️ [Vitest] Install and configure (#2)
* 🚚 [Components] Rename files with test suffix * ♻️ [Components] Update renamed file imports * 🧰 [Vitest] Install and configure
- Loading branch information
Showing
11 changed files
with
2,535 additions
and
335 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,10 @@ | ||
// I more than likely don't actually need this `definitions` file. | ||
declare module '*.mp3' { | ||
const audio: string; | ||
export default audio; | ||
} | ||
|
||
declare module '*.webm' { | ||
const audio: string; | ||
export default audio; | ||
} |
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,14 @@ | ||
import {afterEach, beforeEach} from 'vitest'; | ||
import {cleanup} from '@testing-library/react'; | ||
|
||
import '@testing-library/jest-dom/vitest'; | ||
|
||
beforeEach(() => { | ||
// vi.useFakeTimers(); | ||
}); | ||
|
||
afterEach(() => { | ||
// vi.clearAllTimers(); | ||
// vi.useRealTimers(); | ||
cleanup(); | ||
}); |
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {describe, it} from 'vitest'; | ||
import {render, screen} from '@testing-library/react'; | ||
|
||
function App() { | ||
return <p>Hello World!</p>; | ||
} | ||
|
||
describe('App', () => { | ||
it('renders the App component', () => { | ||
render(<App />); | ||
|
||
// Prints out the JSX in the App component. | ||
screen.debug(); | ||
}); | ||
}); |
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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...omponents/ui/Accordion/Accordion.test.tsx → ...components/ui/Accordion/AccordionTest.tsx
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
File renamed without changes.
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,17 @@ | ||
import {defineConfig, mergeConfig} from 'vitest/config'; | ||
import viteConfig from './vite.config'; | ||
|
||
export default mergeConfig( | ||
viteConfig, | ||
defineConfig({ | ||
test: { | ||
environment: 'jsdom', | ||
globals: true, | ||
setupFiles: 'config/tests-setup', | ||
// Not running tests concurrently because we would | ||
// need to refactor many tests to more thoroughly reset | ||
// between each test. | ||
// sequence: {concurrent: true}, | ||
}, | ||
}), | ||
); |