-
Notifications
You must be signed in to change notification settings - Fork 507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: anchor regexps in Jest transforms for proper JSON handling #513
Conversation
@@ -4,8 +4,8 @@ export function createJestConfig( | |||
) { | |||
const config = { | |||
transform: { | |||
'.(ts|tsx)': require.resolve('ts-jest/dist'), | |||
'.(js|jsx)': require.resolve('babel-jest'), // jest's default | |||
'.(ts|tsx)$': require.resolve('ts-jest/dist'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the $
here just to be consistent!
This may interact with #491 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which should I merge? |
@all-contributors please add @kyle-johnson for bug, code |
I've put up a pull request to add @kyle-johnson! 🎉 |
Master has a new regexp for Jest which breaks tests that reference JSON at some point in the dependency chain. This is a fix.
The regexp
.(js|jsx)
matches.json
which means Jest attempts to load JSON files as JS modules. Since they aren't modules, Jest fails.