Created
March 31, 2018 15:27
-
-
Save scottopell/f71ee6cd8ff09c67e59df85704f5364a to your computer and use it in GitHub Desktop.
How to debug jest tests with create-react-app-ts scripts
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 took me way too long to figure out. | |
// Needs node 8.4.0 or greater to work (I think, based on https://github.com/nodejs/node/issues/7593#issuecomment-322966866) | |
// The magic sauce here is that react-scripts-ts/scripts/test.js creates an inline jest config | |
// that it passes through. This does things like map css files properly, so if you try to use | |
// jest directly then it won't work. | |
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "node", | |
"request": "launch", | |
"name": "Jest Tests", | |
"program": "${workspaceFolder}/node_modules/react-scripts-ts/scripts/test.js", | |
"args": [ | |
"--env=jsdom", | |
"--runInBand" | |
], | |
"env": { | |
"CI": "true" | |
}, | |
"internalConsoleOptions": "openOnSessionStart" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment