include
- Type:
string[] - Default:
['**/*.{test,spec}.?(c|m)[jt]s?(x)'] - CLI:
--include '**/*.test.ts' --include '**/*.spec.ts'
A list of glob patterns that match your test files. These patterns will be resolved relative to the root (process.cwd() by default).
You can run npx rstest list --filesOnly to see the list of test files that Rstest will include.
Default behavior
By default, Rstest will include all javascript / typescript files with .test. or .spec. suffix in the filename.
The following is a visualization of the default pattern:
It should be noted that if you specify index.test.ts as the include pattern, Rstest will only include index.test.ts in the root directory. If you want to include index.test.ts in all subdirectories, you need to use **/index.test.ts.
It should be noted that for a single extension you should write **/*.ts instead of **/*.{ts}. The underlying glob libraries treat single-value braces literally, so **/*.{ts} will not match .ts files.