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.

react-scripts@3.0.0 test command hangs

See original GitHub issue

Is this a bug report?

Yes

Did you try recovering your dependencies?

Yes

Which terms did you search for in User Guide?

(Write your answer here if relevant.)

Environment

Environment Info:

  System:
    OS: Windows 10
    CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
  Binaries:
    Node: 11.1.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.15.2 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 42.17134.1.0
    Internet Explorer: 11.0.17134.1
  npmPackages:
    react: ^16.8.5 => 16.8.6
    react-dom: ^16.8.5 => 16.8.6
    react-scripts: ^2.1.5 => 2.1.8
  npmGlobalPackages:
    create-react-app: Not Found

Also

Same happening on Ubuntu (unable to tell exact version)

Steps to Reproduce

  1. npx create-react-app test
  2. cd test
  3. yarn test

Expected Behavior

Since I don’t have any non staged changes jest should resolve (and run) all the tests.

Actual Behavior

outputs:

$ yarn test
yarn run v1.15.2
$ react-scripts test
No tests found related to files changed since last commit.

and the process hangs (doesn’t exits)

on our Jenkins it ran more than an hour jenkins-hang

Reproducible Demo

https://github.com/Teneff/react-scripts-bug

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
Teneffcommented, Apr 25, 2019

Hi,

does your test environment have the CI environment variable set to true?

It did not.

Adding it resolved the problem.

"scripts": {
-    "test": "react-scripts test",
+    "test": "cross-env CI=true react-scripts test",
},

But this happened when I’ve upgraded from 2.1.5 to 3.0.0. If react-scripts is not responsible for setting it anymore this should be mentioned in the documentation/changelog.

2reactions
Teneffcommented, Apr 25, 2019

The main change I can think of in 3.0 is --coverage used to turn off watch mode, but now that jest supports coverage in watch mode that’s no longer the case.

We’ve always recommend to have the CI env variable set in your CI server if not already set as described at https://facebook.github.io/create-react-app/docs/advanced-configuration. A number of CI providers will set this for you automatically.

as Steps to Reproduce suggest

npx create-react-app test
cd test
yarn test

this issue is also affecting the newly created applications in development environment

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure Dev Ops react-scripts test hangs forever - Stack Overflow
script : set CI=true&&npm test displayName: Test. Official docs: https://create-react-app.dev/docs/running-tests/#continuous-integration.
Read more >
react-scripts | Yarn - Package Manager
Migrating from 5.0.0 to 5.0.1. Inside any created project that has not been ejected, run:
Read more >
Troubleshooting - Create React App
npm test hangs or crashes on macOS Sierra​. If you run npm test and the console gets stuck after printing react-scripts test to...
Read more >
react-app-rewired - npm
1) Install react-app-rewired · 2) Create a config-overrides.js file in the root directory · 3) 'Flip' the existing calls to react-scripts in npm ......
Read more >
Troubleshooting - React Native
Run the following command to find the id for the process that is ... If you run into issues where running npx react-native...
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