Skip to content

Commit

Permalink
add setupRTS script and use it on jest config
Browse files Browse the repository at this point in the history
  • Loading branch information
ErnestTeluk committed Jul 25, 2024
1 parent f84de0f commit 9806b6d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
'^uniforms([^/]*)(.*)$': '<rootDir>/packages/uniforms$1/src$2',
},
preset: 'ts-jest',
setupFiles: ['./scripts/setupFilterWarnings.ts'],
setupFiles: ['./scripts/setupRTS.ts', './scripts/setupFilterWarnings.ts'],
setupFilesAfterEnv: ['./scripts/setupMatchers.ts'],
testEnvironment: 'jsdom',
testPathIgnorePatterns: ['/node_modules/', '/_[^/]*$', '\\.d\\.ts$'],
Expand Down
13 changes: 13 additions & 0 deletions scripts/setupRTS.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Object.defineProperty(window, 'matchMedia', {
writable: true,
value: jest.fn().mockImplementation(query => ({
matches: false,
media: query,
onchange: null,
addEventListener: () => {},
addListener: () => {},
dispatchEvent: () => {},
removeEventListener: () => {},
removeListener: () => {},
})),
});

0 comments on commit 9806b6d

Please sign in to comment.