forked from cardosofelipe/fast-next-template
Suppress jsdom XMLHttpRequest errors in Jest tests
- Added `jest.environment.js` to create a custom Jest environment that filters out harmless XMLHttpRequest errors from jsdom's VirtualConsole. - Updated `jest.config.js` to use the custom environment, reducing noisy test outputs.
This commit is contained in:
@@ -8,7 +8,8 @@ const createJestConfig = nextJest({
|
||||
// Add any custom config to be passed to Jest
|
||||
const customJestConfig = {
|
||||
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
|
||||
testEnvironment: 'jest-environment-jsdom',
|
||||
// Custom environment that suppresses jsdom VirtualConsole XMLHttpRequest errors
|
||||
testEnvironment: '<rootDir>/jest.environment.js',
|
||||
moduleNameMapper: {
|
||||
'^next-intl$': '<rootDir>/tests/__mocks__/next-intl.tsx',
|
||||
'^next-intl/routing$': '<rootDir>/tests/__mocks__/next-intl-routing.tsx',
|
||||
|
||||
Reference in New Issue
Block a user