-
-
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
[Bug]: --filter argument inconsistent with documentation #13222
Comments
As mentioned in #12260, I believe the fix is fairly simple. Either update the documentation to specify that the return type is type T = {
filtered: { test: string }[];
}; or change this line const filteredSet = new Set(filterResult.filtered); I will say that the latter seems more clear as the current implementation seems redundant. |
Thanks @jfw225, I think it makes more sense to just return an array of strings in the shape of |
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. |
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. |
Version
v29.0.2
Steps to reproduce
jest
without argumentsjest --filter=<absolute-path>/filter.js
Expected behavior
I would expect Jest to run all the tests, considering I am not filtering any tests from the given input
Actual behavior
Jest outputs
Pattern: - 0 matches
Additional context
This is not consistent with what the documentation (that can be found here) suggests.
From the docs:
Path to a module exporting a filtering function. This asynchronous function receives a list of test paths which can be manipulated to exclude tests from running by returning an object with the "filtered" property. Especially useful when used in conjunction with a testing infrastructure to filter known broken, e.g.
However, in the
SearchSource.getTestPaths
, we can see that it looks for a property calledtest
in every item returned from the filter.A workaround I did in my environment was to have it return the expected property, like below:
We should probably either update the code so it only expects an array of string as the documentation suggests, or update the documentation to specify it requires the
filtered
property to have an array of shape{ test: string}
Environment
The text was updated successfully, but these errors were encountered: