-
-
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
[Documentation]: CLI --filter option might no be clear enough / Filter {filterPath} did not return a valid test list #12260
Comments
I would be happy to do a PR for the documentation part. |
Just wanted to stress that I spent some good time trying to figure out what was wrong until I finally found this issue. Doc'ing how to filter the tests would be ideal in this case |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
I don't think this should be closed but I'm biased :) |
I'm glad to find this issue, because I had no idea how to use this cli argument. |
why is testPaths not deterministic? How do we get a deterministic testPaths? |
Oops... I could just sort testPaths myself... |
Thanks for documenting this here at least. |
Just to leave a note. Jest’s end-to-end tests is a great usage reference too: https://github.com/facebook/jest/tree/main/e2e/filter |
PR very much welcome for doc changes |
This PR specifies how to use the filtering function CLI option.
@SimenB Done! Waiting for the CLA. |
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
27.4.5
Steps to reproduce
Steps :
(1) Go to the documentation about filter file
(2) Create a working project with a valid jest config
(3) Create a filter file as stated in the doc to be used with
bash --filter=<filename>
(4) Try a few functions
(5) Receive "Filter {filterPath} did not return a valid test list"
Expected behavior
I expected the documentation to provide what I was supposed to write in the file, that is :
"[a] Path to a module exporting a filtering function."
One could expect a function of the type
Or even :
Actual behavior
But, because the code is the following :
and also
I got it to work by using the very undocumented:
I also discovered it was AN ASYNC function :)
Additional context
I would suggest first to maybe update the documentation with something of the sort:
--filter=<file>
Path to a module exporting a filtering function. This asynchronous function receives a list of 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.
Example:
And (but I don't know if it's possible), to edit the set creation
Environment
The text was updated successfully, but these errors were encountered: