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.

Jest crawls FS with `--runTestsByPath` passed

See original GitHub issue

🐛 Bug Report

Jest crawls the file system even an exact test file path is specified. Thus, the test run is slower than it could be.

To Reproduce

Open https://github.com/facebook/jest/tree/master/examples/jquery and install dependencies. Run only needed exact test file path to speed up the test run:

jest --runTestsByPath __tests__/fetch_current_user.test.js

Function nodeCrawl (https://github.com/facebook/jest/blob/v23.6.0/packages/jest-haste-map/src/crawlers/node.js#L130) is called (options.roots contains the project root).

Expected behavior

The file system is not crawled => faster test run.

Run npx envinfo --preset jest

Paste the results here:

  System:
    OS: Windows 10
    CPU: x64 Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
  Binaries:
    Yarn: 1.7.0 - C:\Users\Sergey.Simonchik\AppData\Roaming\npm\yarn.CMD
    npm: 6.1.0 - C:\Program Files\nodejs\npm.CMD

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
SimenBcommented, Sep 30, 2018

Issue for daemon: #5950.

Closing, but happy to reopen if we’re able to prove that there is a lot of gain to be had by short-circuiting the initial crawl

0reactions
github-actions[bot]commented, May 12, 2021

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest CLI Options
If you run Jest via yarn test , you can pass the command line arguments directly as Jest arguments. Instead of: jest -u...
Read more >
Jest --runTestsByPath two or more different paths
I'm wondering, because it is not documented anywhere, or answered here on SO, how can I pass two or more different paths to...
Read more >
jest-cli | Yarn - Package Manager
Fast interactive mode can switch between running all tests or only test files related to changed files.
Read more >
Jest and GitHub Actions. Unit test, end to end test and CI.
This blog post covers Unit tests, end-to-end tests and CI. This article uses Url Pilgrim as a case study. To add unit and...
Read more >
Jest CLI Options - w3resource
When you run Jest via yarn test, you can pass the command line arguments as Jest arguments directly. Rather than: jest -u -t="ColorPicker"....
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