question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Babel error when running tests with --coverage

See original GitHub issue

Description

Steps:

  • create a fresh app
  • anywhere inside App.js, add the following code
function* test() {
  yield ((a) => 42)
}
  • run npm run test => works
  • run npm run test -- --coverage => crashes

Expected behavior

This syntax is valid js, it works in the browser and with tests without coverage so I expect it to work with coverage activated

Actual behavior

This error is thrown: image

Environment

  1. npm ls react-scripts
test@0.1.0 /Users/gael/Desktop/test
└── react-scripts@0.8.1
  1. node -v:
v6.4.0
  1. npm -v:
3.10.6
  1. Operating system: OSX 10.12.1
  2. Browser and version: N/A

I guess this is a Jest issue, so I ping @cpojer ?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
gaearoncommented, Dec 7, 2016

This doesn’t reproduce on master, and likely was fixed by #1179. The next patch will address it.

0reactions
gaelolliviercommented, Dec 8, 2016

Working like a charm, thanks for the fast patch !

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failing coverage with babel-jest - vue.js - Stack Overflow
So in first case, tests are running but coverage no. And in second case, tests and coverage works but an error is thrown....
Read more >
babel-plugin-istanbul - npm
Configure Mocha to transpile JavaScript code using Babel, then you can run your tests with nyc , which will collect all the coverage...
Read more >
Test runner Addon | Storybook: Frontend workshop for UI ...
The test runner supports code coverage with the --coverage flag or STORYBOOK_COLLECT_COVERAGE environment variable. The pre-requisite is that your components ...
Read more >
@cypress/code-coverage - Awesome JS
Saves the code coverage collected during Cypress tests ... For example, if you are already using Babel to transpile you can add babel-plugin-istanbul...
Read more >
Configuring Jest
By default, Jest runs all tests and produces all errors into the console ... The babel and v8 coverage providers use /* istanbul...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found