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.

After upgrade to CRA 2.0, tests run very slow.

See original GitHub issue

Is this a bug report?

I think so.

After upgrade to CRA 2.0 Jest tests run much slower than before. I think it could be made by Jest 23

Did you try recovering your dependencies?

yes, but problem still exists

Which terms did you search for in User Guide?

Running Tests

Environment

Environment: OS: Windows 10 Node: 8.11.2 Yarn: 1.10.1 npm: 6.4.1 Watchman: Not Found Xcode: N/A Android Studio: Not Found

Packages: (wanted => installed) react: ^16.5.2 => 16.5.2 react-dom: ^16.5.2 => 16.5.2 react-scripts: 2.0.3 => 2.0.3

Steps to Reproduce

Tests in previous version reloaded less than 1s. After upgrade to CRA 2.0 tests reload in about 3-4sec. Problec occurs even if I create new empty project

  1. create-react-app app
  2. npm run test

Expected Behavior

It should be faster 😦

Actual Behavior

image

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:8
  • Comments:27 (13 by maintainers)

github_iconTop GitHub Comments

6reactions
empzcommented, Dec 21, 2018

Fresh create-react-app (2.1.1).

 PASS  src/App.test.js
  √ renders without crashing (41ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        6.447s
Ran all test suites.

Watch Usage: Press w to show more.

So while the test actually seems to run pretty fast (41ms), the setup takes 6 seconds. Re-running doesn’t make it faster.

Windows 10 x64, I7 4690K, SSD…

4reactions
lukaszczernalcommented, Jan 1, 2019

We also struggle with slow tests if we run: react-scripts-ts test --env=jsdom image

but if we run them with coverage flag they are way faster react-scripts-ts test --env=jsdom --coverage image

I understand that it should be the opposite 😃

We are running: "react": "^16.2.0", "react-dom": "^16.2.0", "react-redux": "^5.0.6", "react-router-dom": "^4.2.2", "react-scripts-ts": "2.17.0", "enzyme-adapter-react-16": "^1.1.1",

Read more comments on GitHub >

github_iconTop Results From Across the Web

With CRA upgrade from 3.4.1 to 4.0.3 tests are running much ...
the tests are 3x slower when run with runInBand , they take approx. 1700 seconds compared to approx. 600 seconds before the update;;...
Read more >
How to make your sluggish Jest tests go faster - ITNEXT
A step-by-step guide how to improve performance of your slow Jest unit test and make them blazingly fast and delightful again.
Read more >
Running Tests | Create React App
Every time you save a file, it will re-run the tests, like how npm start recompiles the code. *Although we recommend running your...
Read more >
CRA typescript is compiling slow - DEV Community ‍ ‍
CRA with typescript is bit slow even after "skipLibCheck": true . Mostly I find hitting F5 better than waiting for the page to...
Read more >
Optimizing Performance - React
However, they make React larger and slower so you should make sure to use the production version ... If your project is built...
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