Open cmparsons opened 1 year ago
hey @cmparsons! Thanks for the suggestion!
I'll look into adding support for this to the @nx/jest:jest
executor. Please note that if you're using inferred tasks for Jest, you can already do this:
nx test <project> path/to/spec/file1 path/to/spec/file2
nx test <project> filename1 filename2
nx test <project> path/to/folder/containing/spec/files
The tasks inferred by the @nx/jest
plugin run the Jest CLI directly jest
from the project root as cwd. So, you're able to use anything the Jest CLI supports.
This issue has been automatically marked as stale because it hasn't had any activity for 6 months. Many things may have changed within this time. The issue may have already been fixed or it may not be relevant anymore. If at this point, this is still an issue, please respond with updated information. It will be closed in 21 days if no further activity occurs. Thanks for being a part of the Nx community! 🙏
Description
Similar to the existing
testFile
option, adding an option to the Jest executor that supports passing a list of tests files to run.Motivation
The
@nx/vite:test
plugin seems to support this behavior already withtestFiles
, and it seemstestFiles
has replacedtestFile
, so this feature could bridge the functionality between the two test runners.At Netlify, we use the
circleci tests run
command to split tests for parallelization and to utilize CircleCI's rerun failed tests feature. CircleCI's CLI will pass tests as a space-delimited list of files, so ideally we could easily hook into this behavior with a command like:Suggested Implementation
Add a new option called
testFiles
to the Jest executor that is either a string with the expectation that it's a space-delimited list of file names or to match the vitest plugin, an array of strings (I'm not sure hownx
would parse this from the CLI).Alternate Implementations