-
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.
- Loading branch information
1 parent
1631e3e
commit ab992c2
Showing
4 changed files
with
26 additions
and
13 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
import { defineConfig } from 'vitest/config'; | ||
import react from '@vitejs/plugin-react'; | ||
import { resolve } from 'path'; | ||
|
||
export default defineConfig({ | ||
resolve: { | ||
alias: { | ||
'@': '/', | ||
'@': resolve(__dirname, './'), | ||
}, | ||
}, | ||
test: { | ||
globals: true, // Enable global APIs | ||
environment: 'jsdom', // Use jsdom environment for browser-like testing | ||
css: false, | ||
setupFiles: './vitest.setup.ts', // Optional setup file | ||
globals: true, | ||
environment: 'jsdom', | ||
setupFiles: './vitest.setup.ts', | ||
}, | ||
plugins: [react()], // Add the React plugin | ||
}); | ||
plugins: [react()], | ||
}); |
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,2 +1,15 @@ | ||
// vitest.setup.ts | ||
import '@testing-library/jest-dom'; // Import this to use jest-dom matchers | ||
import '@testing-library/jest-dom'; // Import this to use jest-dom matchers | ||
|
||
// Suppress jsdom CSS parsing errors | ||
const suppressedErrors = /(Could not parse CSS stylesheet)/; | ||
|
||
const originalConsoleError = console.error; | ||
console.error = (...args) => { | ||
if (args[0] && suppressedErrors.test(args[0])) { | ||
// Suppress the specific jsdom CSS error | ||
return; | ||
} | ||
// Call the original console.error for other errors | ||
originalConsoleError(...args); | ||
}; |