-
Notifications
You must be signed in to change notification settings - Fork 306
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
Add section to troubleshooting about JS files transpiling #68
Conversation
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.
Few nits and we're good to go. Thank you so much for doing this ❤️
README.md
Outdated
"presets": ["env"] | ||
} | ||
``` | ||
2. Specify jest how to transpile JS files in jest configuration: |
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.
Let's change it to:
Update Jest configuration (by default TypeScript process untranspiled JS files which is source of the problem):
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.
done
README.md
Outdated
@@ -178,6 +178,26 @@ By default Jest doesn't transform `node_modules`, because they should be valid J | |||
``` | |||
This tells `ts-jest` (a preprocessor this preset using to transform TS files) to treat JS files the same as TS ones. | |||
|
|||
#### Transpile js files through `babel-jest` | |||
Some vendors publish their sources without transpiling. You need to say jest to transpile such files manually since `typescript` (and thus `ts-jest`) do not transpile them. | |||
1. Install `babel-preset-env` with npm or yarn and add `.babelrc` (or modify existing if needed) with that contents: |
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.
Remove the with npm or yarn
part
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.
done
README.md
Outdated
@@ -178,6 +178,26 @@ By default Jest doesn't transform `node_modules`, because they should be valid J | |||
``` | |||
This tells `ts-jest` (a preprocessor this preset using to transform TS files) to treat JS files the same as TS ones. | |||
|
|||
#### Transpile js files through `babel-jest` | |||
Some vendors publish their sources without transpiling. You need to say jest to transpile such files manually since `typescript` (and thus `ts-jest`) do not transpile them. |
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.
(and thus
ts-jest
used by this preset)
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.
done
I fixed everything. |
🎉 |
* origin/master: Adds a warning about html transforms. (thymikee#94) Update README to include installation instructions. (thymikee#84) Add doctype to test environment (thymikee#78) v4.0.0 v4.0.0 changelog Update changelog for master v4.0.0-alpha.1 Use universal zone.js instead of node-only (thymikee#76) Add custom environment (thymikee#75) Add fakeAsync test v3.0.2 Clarify AngularJS support More accurate moduleNameMapper regexps (thymikee#71) Update CHANGELOG.md v3.0.1 Bump jest and ts-jest to v21 (thymikee#70) v3.0.0 Tighten up module mappers; bump jest (thymikee#53) Add section to troubleshooting about JS files transpiling (thymikee#68)
FYI @thymikee @DorianGrey
Did I write everything correct?
Sorry for possible mistakes (English is not my native language😿 ).