How to run tests from a specific directory (only system tests or features specs)?
To run only tests from a specific directory with knapsack_pro
gem you need to set environment variable KNAPSACK_PRO_TEST_FILE_PATTERN
.
Please ensure your pattern matches individual test files (there is ending like _spec.rb
or _test.rb
in the pattern name). For instance to run tests from system directory use:
KNAPSACK_PRO_TEST_FILE_PATTERN="spec/system/**/*_spec.rb"
Otherwise, you will match the whole directory (invalid pattern example: KNAPSACK_PRO_TEST_FILE_PATTERN="spec/system/*"
- bad because of low granularity). We want to split test files across parallel CI nodes with high granularity by individual test files instead of splitting by directories.
To learn how to run tests from multiple directories check this tip.