Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #1156
Closed
Open
Issue created Dec 05, 2016 by Administrator@rootContributor

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:

  1. 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 
  1. node -v:
v6.9.1
  1. npm -v:
4.0.3

Then, specify:

  1. Operating system: Ubuntu 16.04.1 LTS
  2. Browser and version: not applicable
Assignee
Assign to
Time tracking