Commit 89c7b2b
committed
fix: add --roots flag to Jest to include test file directories
Some projects configure Jest with restricted roots (e.g., roots: ["<rootDir>/src"])
which prevents Jest from finding tests written to other directories like "test/".
Even with --runTestsByPath, Jest validates that files exist within the configured
roots.
This fix adds the --roots flag to explicitly include the directories containing
the test files being run, ensuring Jest can find and execute them regardless of
the project's roots configuration.
Fixes issue where "No tests found" error occurs on projects with custom Jest
roots configuration.1 parent e7e562e commit 89c7b2b
1 file changed
Lines changed: 20 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
260 | | - | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
261 | 268 | | |
262 | 269 | | |
263 | 270 | | |
| |||
467 | 474 | | |
468 | 475 | | |
469 | 476 | | |
470 | | - | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
471 | 483 | | |
472 | 484 | | |
473 | 485 | | |
| |||
596 | 608 | | |
597 | 609 | | |
598 | 610 | | |
599 | | - | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
600 | 617 | | |
601 | 618 | | |
602 | 619 | | |
| |||
0 commit comments