How to run a specific list of test files or only some tests from test file?
Note: If you don't want to use the pattern
KNAPSACK_PRO_TEST_FILE_PATTERN (see) to define a list of tests to run then read below two options.
Option 1 - read a list of test files from env var
If you want to run a specific list of test files that are explicitly defined by you or auto-generated by some kind of script you created then please use:
KNAPSACK_PRO_TEST_FILE_LIST must be a list of test files comma separated. You can provide line number for tests inside of spec file in case of RSpec (this way you can run only one test or a group of tests from RSpec spec file). You can provide the same file a few times with different test line number.
Option 2 - read a list of test files from a source file
Similarly, you can also provide a source file containing the test files that you would like to run. This might be useful when you have a very large list of test files.
And the content of the source file can be any of the format below:
./spec/test1_spec.rb spec/test2_spec.rb ./spec/test3_spec.rb[1:2:3:4] ./spec/test4_spec.rb:4 ./spec/test4_spec.rb:5
Note that each of the line must be ending with
\n the new line.
Note when you set
KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE then below environment variables are ignored: