jestjs / jestjs/jest

Very poor performance on basic tests

Open
#7,963 92 comments 213 reactions 0 assignees View on GitHub
:bug: Bug
Dominant language
TypeScript
Stars
45.5k
Forks
6.7k
Avg merge
17h 22m
Merged PRs (30d)
24

Description

## 🐛 Bug Report

I've created a simple test with no configuration. You can find it [here](https://github.com/cozmy/jest-performance). It takes 7.6 seconds just to start jest, and then, on file change, it takes 5 seconds to re-run.
There's clearly something wrong here.

Mocha and Chai, for example, start in around 4 seconds, but afterward, the re-run is almost instant.

It's weird that Jest reports that the test takes 14ms but shows me the result in 5 seconds.

![image](https://user-images.githubusercontent.com/5887290/53284091-c519de00-3757-11e9-85c2-33fb4bd8eb33.png)

On top of this, if you add more basic tests, the time just seems to go up.

![image](https://user-images.githubusercontent.com/5887290/53284146-a9fb9e00-3758-11e9-9297-1a1bbc5e1184.png)

## To Reproduce

Clone [my minimal repository](https://github.com/cozmy/jest-performance), `yarn install` and `yarn test`.

## Expected behavior

It should be faster than this.

## Link to repl or repo (highly encouraged)

https://github.com/cozmy/jest-performance

## Run `npx envinfo --preset jest`

Paste the results here:

```
System:
OS: Windows 10
CPU: (8) x64 Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz
Binaries:
Node: 8.12.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.13.0 - C:\Users\CosminCristian\AppData\Roaming\npm\yarn.CMD
npm: 6.8.0 - C:\Program Files\nodejs\npm.CMD
```

Contributor guide

Open the contributing guide

Research direction

Clone the linked minimal repository, run yarn install and yarn test, and compare the reported startup and file-change rerun times on the supplied Windows environment. Read the issue comments for any narrowed scope or proposed direction; done means reproducing the delay and identifying a concrete performance regression or actionable cause in Jest.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
performance, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.