-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Passing in test files to CLI should be matched against relative path #10746
Comments
Key location to edit seems to be here: https://github.com/facebook/jest/blob/504cacee18b844a974e76e5c45b2568bf023d3ac/packages/jest-core/src/SearchSource.ts#L296-L300 |
To be fair, Jest at least consistently does this (resolving to absolute paths) pretty much anywhere we use paths. |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 14 days. |
I still think this would be good to fix |
I'd honestly consider this a bug. We need to work if you pass an absolute path, but we should probably special case absolute paths instead. Matching on patterns outside of Is this something you'd be willing to work on? |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
PR is waiting for review |
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. |
🚀 Feature Proposal
When running
jest foo
,foo
should be matched against the path relative topackage.json
instead of its absolute path.Motivation
We have a test file
user.spec.ts
, and accidentally runningjest user
runs all tests, because the full path of all the test files starts with/Users/my-username/...
. It's also odd to runjest foo
and not see the string "foo" anywhere in the outputExample
Pitch
This oddity is confusing behavior that should at least be documented. The current documentation says
which is confusing if the regular expression can also match directories outside of my project. I can't think of a good reason to keep this behavior (why would you want a regex matching all of the test files in your project?)
The text was updated successfully, but these errors were encountered: