Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #7458
Closed
Open
Issue created Aug 01, 2019 by Administrator@rootContributor

Adding roots to Jest config

Created by: mucsi96

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 executing npm 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 to graceful-fs readdir function. After adding a console.log there I discovered that the function was called on every directory inside .git and node_modules folders. See attached log.

Describe the solution you'd like

To try to improve the performance I have added roots: ['<rootDir>/src'], to createJestConfig.js. After that there were no readdir calls apart from src folder. With that the test execution time went down to 20 seconds. This is a 43% speed improvement on my machine.

Assignee
Assign to
Time tracking