Open cmparsons opened 9 months 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.
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