Tests are failing after upgrade to 0.8.1
Created by: just-boris
If you are reporting a bug, please fill in below. Otherwise feel free to remove this template entirely.
Can you reproduce the problem with latest npm?
I have Yarn installed, so CRA used latest yarn@0.18.0 to setup.
Description
My test command fails with the following error
FAIL src/App.test.js
● Test suite failed to run
TypeError: /home/bserdiuk/coding/test/src/App.test.js: Cannot read property 'length' of null
at Buffer._append (node_modules/babel-generator/lib/buffer.js:83:25)
at Buffer.append (node_modules/babel-generator/lib/buffer.js:55:10)
at Generator._append (node_modules/babel-generator/lib/printer.js:206:52)
at Generator.word (node_modules/babel-generator/lib/printer.js:131:10)
at Generator.Identifier (node_modules/babel-generator/lib/generators/types.js:38:8)
at node_modules/babel-generator/lib/printer.js:298:23
at Buffer.withSource (node_modules/babel-generator/lib/buffer.js:142:28)
at Generator.withSource (node_modules/babel-generator/lib/printer.js:189:15)
at Generator.print (node_modules/babel-generator/lib/printer.js:297:10)
at Generator.VariableDeclarator (node_modules/babel-generator/lib/generators/statements.js:309:8)
It worked fine with version 0.7.0, today I tried to upgrade to latest 0.8.1 and got the error above.
I have generated new test application with latest create-react-app
and react-scripts
and could find a minimal example to reproduce.
Add the following test in your test files, then run npm test
.
it('async test', async () => {
const {result} = doSometing();
});
Basically, destructuring assignment doesn't work in async
function with Jest.
Babel Repl transpiles this code fine. Also it works fine if I will put this code into source. Problem appears only in testing code.
Expected behavior
I expect that it works as it was before in 0.7.0
Actual behavior
Tests are not run, error appears before any test starts.
Environment
Run these commands in the project folder and fill in their results:
-
npm ls react-scripts
(if you haven’t ejected):
npm ls react-scripts
test@0.1.0 /home/bserdiuk/coding/test
└── react-scripts@0.8.1
-
node -v
:
v6.9.1
-
npm -v
:
4.0.3
Then, specify:
- Operating system: Ubuntu 16.04.1 LTS
- Browser and version: not applicable