Improve syntax error reporting; revert babel-runtime change. #787
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This diff makes a number of changes:
babel-jest
is installed but.babelrc
is not properly set up. The code may use imports but it doesn't transform them into requires--no-cache
.node_modules
. Since the message is part of the stack trace, it would filter outPreprocessor: node_modules/babel-jest
. That took a while to figure out… I changed the stacktrace filter to look for\s+at
in the beginning of the message.SyntaxError
, so it bypasses this check. This is actually nice – it means we can show this message only while people have trouble setting up their preprocessor.--verbose
mode, probably because @gaearon and I were working on the same code on the same time and after the merge of Haste2 #599 this got lost again. Unfortunately the reporter code is a bit unwieldy and hard to test – there is an internal task that tracks the rewrite of that component.babel-runtime
again. It was added in Update babel-jest for better code coverage #785 but I had a chat with some of the babel core developers and it seems like the best course of action is to keepbabel-polyfill
.babel-runtime
can be added by people who usebabel-jest
through.babelrc
. Because Jest sets theNODE_ENV
variable to test, it can be enabled just for the test environment as well. TheauxiliaryCommentBefore
option should be enough to fix code coverage reporting.