-
-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding roots to Jest config #7458
Labels
Comments
You're right - it seems because we've specified Good finding! Would you like to create a PR to add |
Great! Sure I am happy to do that! |
PR raised: #7480 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
test.log
Is your proposal related to a problem?
My problem is that Jest test are running slow. I have tried CRA with TypeScript using
npx create-react-app my-app --typescript
. After that executingnpm test
on Windows 10 machine took 35 seconds. I started to investigate why it's so slow. After making a CPU profile I saw huge number of calls tograceful-fs
readdir
function. After adding a console.log there I discovered that the function was called on every directory inside.git
andnode_modules
folders. See attached log.Describe the solution you'd like
To try to improve the performance I have added
roots: ['<rootDir>/src'],
tocreateJestConfig.js
. After that there were noreaddir
calls apart fromsrc
folder. With that the test execution time went down to 20 seconds. This is a 43% speed improvement on my machine.The text was updated successfully, but these errors were encountered: