Skip to content
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

Merged
merged 4 commits into from
Aug 26, 2017

Conversation

sharikovvladislav
Copy link
Contributor

@sharikovvladislav sharikovvladislav commented Aug 26, 2017

FYI @thymikee @DorianGrey

Did I write everything correct?

Sorry for possible mistakes (English is not my native language😿 ).

Copy link
Owner

@thymikee thymikee left a 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:
Copy link
Owner

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):

Copy link
Contributor Author

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:
Copy link
Owner

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

Copy link
Contributor Author

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.
Copy link
Owner

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)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@sharikovvladislav
Copy link
Contributor Author

I fixed everything.

@thymikee thymikee merged commit 4123477 into thymikee:master Aug 26, 2017
@thymikee
Copy link
Owner

🎉

sharikovvladislav added a commit to sharikovvladislav/jest-preset-angular that referenced this pull request Nov 28, 2017
* 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants