Skip to content
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

Jest25: --findRelatedTests not working in hidden directory on windows #9728

Closed
nicojs opened this issue Mar 30, 2020 · 1 comment · Fixed by #11548
Closed

Jest25: --findRelatedTests not working in hidden directory on windows #9728

nicojs opened this issue Mar 30, 2020 · 1 comment · Fixed by #11548

Comments

@nicojs
Copy link
Contributor

nicojs commented Mar 30, 2020

🐛 Bug Report

Since v25, --findRelatedTests no longer works on Windows when running in a hidden directory (a directory starting with a .).

To Reproduce

A really small reproduction repo can be found here: https://github.com/nicojs/jest-find-related-test-bug

On windows:

git clone git@github.com:nicojs/jest-find-related-test-bug.git
cd jest-find-related-test-bug/.hidden
npm i
npx jest --findRelatedTests src/sum.js

Expected behavior

 PASS  src/sum.test.js
  √ adds 1 + 2 to equal 3 (2ms)
  √ sub 1 - 0 to equal 1

Test Suites: 1 passed, 1 total
Tests:       2 passed, 2 total
Snapshots:   0 total
Time:        3.381s
Ran all test suites related to files matching /src\\sum.js/i.

But was:

No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In C:\z\github\nicojs\jest-find-related-test-bug\.hidden
  4 files checked.
  testMatch: **/__tests__/**/*.[jt]s?(x), **/?(*.)+(spec|test).[tj]s?(x) - 1 match
  testPathIgnorePatterns: \\node_modules\\ - 4 matches
  testRegex:  - 0 matches
Pattern: src\\sum.js - 0 matches

This behavior broke with jest@25. I.e. this works:

npm i jest@24
npx jest --findRelatedTests src/sum.js

Moving the code to a non-hidden directory also works:

cd ..
mv .hidden hidden
cd hidden
npx jest --findRelatedTests src/sum.js

Or Linux also seems to work (tested with Windows Subsystem for Linux).

Link to repl or repo (highly encouraged)

https://github.com/nicojs/jest-find-related-test-bug

envinfo

 System:
    OS: Windows 10 10.0.18363
    CPU: (8) x64 Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
  Binaries:
    Node: 12.16.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.12.3 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.13.6 - C:\Program Files\nodejs\npm.CMD
  npmPackages:
    jest: ^25.2.3 => 25.2.3
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant