-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
handle typescript by default #7533
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,6 +137,10 @@ const setupBabelJest = (options: InitialOptions) => { | |
const regex = new RegExp(pattern); | ||
return regex.test('a.js') || regex.test('a.jsx'); | ||
}); | ||
const customTSPattern = Object.keys(transform).find(pattern => { | ||
const regex = new RegExp(pattern); | ||
return regex.test('a.ts') || regex.test('a.tsx'); | ||
}); | ||
|
||
if (customJSPattern) { | ||
const customJSTransformer = transform[customJSPattern]; | ||
|
@@ -148,6 +152,17 @@ const setupBabelJest = (options: InitialOptions) => { | |
babelJest = customJSTransformer; | ||
} | ||
} | ||
|
||
if (customTSPattern) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure about this one. Is this correct? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. couldn't we just extend the const customPattern = Object.keys(transform).find(pattern => {
const regex = new RegExp(pattern);
return regex.test('a.js') || regex.test('a.jsx') || regex.test('a.ts') || regex.test('a.tsx');
}); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, that doesn't make sense There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what if there are different patterns for |
||
const customTSTransformer = transform[customTSPattern]; | ||
|
||
if (customTSTransformer === 'babel-jest') { | ||
babelJest = require.resolve('babel-jest'); | ||
transform[customTSPattern] = babelJest; | ||
} else if (customTSTransformer.includes('babel-jest')) { | ||
babelJest = customTSTransformer; | ||
} | ||
} | ||
} else { | ||
babelJest = require.resolve('babel-jest'); | ||
options.transform = { | ||
|
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.
this is my "test plan". The tests still run (and pass)