include
- Type:
string[] - Default:
['**/*.{test,spec}.?(c|m)[jt]s?(x)'] - CLI:
--include '**/*.test.ts' --include '**/*.spec.ts'
Glob patterns that match test files, resolved relative to root (process.cwd() by default). Setting include replaces the default patterns.
Run npx rstest list --filesOnly to inspect the matched test files:
Default behavior
By default, Rstest matches JavaScript and TypeScript files whose filenames contain .test. or .spec.:
Patterns without a directory prefix (such as index.test.ts) match only in the root directory. Use **/index.test.ts to match subdirectories:
For a single extension, write **/*.ts instead of **/*.{ts}. Single-value braces are matched literally, so **/*.{ts} does not match .ts files.