-
-
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
Conversation
@@ -15,18 +15,5 @@ | |||
}, | |||
"scripts": { | |||
"test": "jest" | |||
}, | |||
"jest": { |
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)
@@ -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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
couldn't we just extend the customJSPattern
check?
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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
what if there are different patterns for js
and ts
, such as ts-jest
?
/cc @kulshekhar @huafu @GeeWee. I don't think |
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.
LGTM
Just want to say that I am excited as fuck for this. I think we might have to change some docs on the |
Awesome! I think docs and maybe the preset (as it won't have to set |
Yeah that's what I'm thinking as well. |
Co-Authored-By: SimenB <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #7533 +/- ##
=========================================
- Coverage 67.71% 67.7% -0.02%
=========================================
Files 247 247
Lines 9501 9504 +3
Branches 5 5
=========================================
+ Hits 6434 6435 +1
- Misses 3065 3067 +2
Partials 2 2
Continue to review full report at Codecov.
|
For people coming to this thread, it has been released in |
I know this is very early, but does this patch include support for TS features like path mapping? (Not sure if this is covered by Babel) 🙂 |
We rely on Babel for our default TS support. If you need something more advanced, then ts-jest is a way to go like it always was. |
This is using purely babel, no tsconfig config is picked up. You'll want to use https://jestjs.io/docs/en/configuration.html#modulenamemapper-object-string-string. Or EDIT: Heh, what he said |
This means that if I want to use different |
if you want to use a tsconfig at all you need to use ts-jest |
As someone who only writes TS, love this. <3 Edit: I just tested the beta with this PR and everything worked great with TS. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Now that we've landed Babel 7, I think we should handle TypeScript by default, next to JS, JSX and Flow.
See https://2018.stateofjs.com/javascript-flavors/overview/ for why I think this should be #0C
Test plan
We have an integration test with Babel and typescript, so I just removed its config.