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.

Tests are running much slower in 7.0.0-alpha.1 with --no-cache

See original GitHub issue

My setup: babel-preset-env: 1.7.0, jest: 23.6.0, jest-preset-angular: 7.0.0-alpha.1, jest-sonar-reporter: 2.0.0,

I am using babel-jest to process *.js files.

I am trying to upgrade from 6.0.0 -> 7.0.0-alpha.1. I am running jest with: npm run jest -- --no-cache and observing that the time required to finish tests goes up from ~120s to around 950s. When i enable the cache, then the first run is slow, but consecutive run is much faster (same as in version 6.0.0) - around 30s.

Anyone else experiencing same behavior? What could be the cause for this, where should i look?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ahnpnlcommented, Dec 16, 2018

FYI, this might be one of the causes of performance

1reaction
Ludevikcommented, Dec 11, 2018

@wtho @thymikee thanks. I have tested with alpha.2 and it is a bit faster. I’m currently at ~500s with --no-cache and 300s on the first run after --clearCache. I’ve put log into create visitor function and it is called multiple times for some .ts files, it depends on the situation. Jest spawns 7 threads on my machine to run the tests and each of that thread transforms .ts and .js files on its own, so some of the files are transformed multiple times, up to 7 times. I understand now why each of my file in library is transformed 7 times when i change the mapping from dist to src. It is because when i tell jest to use dist folder it doesn’t need to transform my library as it is already compiled to .js. When i ran my tests with src then i got 7 hits in createVisitor for my library’s index.ts files which in turn transforms 7 times every exported library file.

I will write a question to ts-jest directly as jest-preset-angular just uses that and it seems that the astTransformer is quite fast.

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Jest - Simple tests are slow - Stack Overflow
Another possibility is that ts-jest is slow. There was an issue about that, and it was not completely resolved. There are various workarounds...
Read more >
Caching is very slow for Node.JS projects - gitlab-runner
Ideally in this scenario the runner would just unpack the cache created by the previous build job within the test jobs and completely...
Read more >
Diagnosing a single slow test - Jon Skeet's coding blog
I have near-identical hardware to run tests on: gabriel is running Linux; bagpuss is running Windows. Under a release build, the test takes...
Read more >
Setting up super fast Cypress tests on GitHub Actions - PostHog
Enter Cypress. According to Cypress's GitHub repo it is a fast, easy and reliable testing for anything that runs in a browser. What...
Read more >
Test run slow when running with `--test com.example.FooTest`
When running tests using --tests, gradle seems to initialize other tests (although it does not run them) this significantly adds to test run...
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