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

Error Unexpected token (Object spread) when running jest with --coverage OR transform key #5070

Closed
wilhelmklopp opened this issue Dec 12, 2017 · 2 comments

Comments

@wilhelmklopp
Copy link

Cross posting from kulshekhar/ts-jest#386 as it seems like it's not a ts-jest issue

Do you want to request a feature or report a bug?
Report a bug

Issue

When I run jest with coverage turned on jest --coverage and the tranform key present in package.json
e.g.:

"transform": {
      "^.+\\.tsx?$": "ts-jest"
    },

every test that involves an object spread operator fails.

If I either:

  • run jest without --coverage
    or
  • run jest without the transform key present in package.json

all tests pass fine (in the second case, minus of course typescript tests, which I need ts-jest's transform for 😬 )

I'm running:
jest: 21.2.1
ts-jest: 21.2.4
node: v8.9.0
npm: 5.6.0
mac: 10.12.6 (16G29) (but problem occurring in stock Travis builds as well)

I am not using any kind of babel config, although while investigating this problem I tried using babel-plugin-transform-object-rest-spread, but it didn't seem to have made a difference.

Minimal Repo that reproduces the issue

Link to a minimal repo that reproduces this issue. There's also a branch that shows what happens when transform is removed from package.json
Travis is configured on this repo. Relevant build

Additional background info

Prior to adding ts-jest to the setup, I had this same problem with jest as well, but this PR (and subsequent release back in September) fixed it: #4519

Any thoughts on what the problem might be? 🙇

@wilhelmklopp
Copy link
Author

Fixed by modifying transform key to pass both ts and js files to ts-jest, not just ts files.

Details

Sorry for the noise 🙏

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant