Last active
September 27, 2022 13:37
-
-
Save nathansmith/cbd35fd5ed10868cf41d689181dbd477 to your computer and use it in GitHub Desktop.
Jest test setup
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
require('@testing-library/jest-dom'); | |
// Override. | |
Object.defineProperty(window, 'requestAnimationFrame', { | |
writable: true, | |
value: (f) => { | |
if (typeof f === 'function') { | |
f(); | |
} | |
}, | |
}); |
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
{ | |
"jest": { | |
"moduleFileExtensions": [ | |
"js", | |
"svelte", | |
"ts" | |
], | |
"setupFilesAfterEnv": [ | |
"<rootDir>/scripts/test-setup.js" | |
], | |
"testEnvironment": "jsdom", | |
"transform": { | |
"^.+\\.svelte$": [ | |
"svelte-jester", | |
{ | |
"preprocess": true | |
} | |
], | |
"^.+\\.ts$": "ts-jest", | |
"^.+\\.js$": "babel-jest" | |
}, | |
"transformIgnorePatterns": [ | |
"<rootDir>/node_modules/lodash-es" | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment