Closed avanderhoorn closed 7 years ago
Potentially related to #1922.
@avanderhoorn can you test against jest-cli@15 babel-jest@15
and see if you have the same issue?
Seems like babel doesn't read the .babelrc
file. so it doesn't include any of the plugins nor the presets defined there. Having a similar issue, now the problem seems to be a SyntaxError: Unexpected token import
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import Action from './Action';
^^^^^^
SyntaxError: Unexpected token import
at transformAndBuildScript (node_modules/jest-runtime/build/transform.js:284:10)
My .babelrc is on the root project and looks like:
{
"presets": [
["es2015", { "modules": false }],
"stage-2",
],
"plugins": [
["external-helpers"]
]
}
I have jest-cli@16.0.2
and babel-jest@16.0.0
I am confident my issue is related to the one described in this issue.
Try jest --no-cache
one time. This should be fixed with #2023.
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.
I have a file within the code base that Jest is trying to execute tests in that was getting a weird
Unexpected token .
exception being thrown as the test was running. I tracked it down to one of thebabelJest.process
step in the preprocessor that I have registered. The following shows a sample of a preprocessor that exhibits the issue, what the input is and what the output is.If I take the input and run it directly in the live previewer on the babel site, the results are fine. This leads me to wonder if its one of the plugins that jest/babel-jest register or something to do with istanbul maybe.
Preprocessor with JS that cases jest/babel-jest/babel to create malformed js:
Raw content formated:
And this is the malformed output that jest/babel-jest/babel creates:
You can see that for some reason, babel is placing a number of line breaks just after the
exports.
which is causing the following exception:Here is the output from
--debug
: