Skip to content

Commit 8fcefef

Browse files
authored
Remove testPathPatterns Jest config details from v30 upgrade guide (#15661)
1 parent 109069b commit 8fcefef

File tree

1 file changed

+9
-31
lines changed

1 file changed

+9
-31
lines changed

docs/UpgradingToJest30.md

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -77,41 +77,19 @@ If your project contains files with these extensions that are **not** intended t
7777

7878
:::
7979

80-
### `testPathPattern` Renamed to `testPathPatterns`
80+
### `--testPathPattern` Renamed to `--testPathPatterns`
8181

82-
If you filter tests by path, note that the configuration option and CLI flag have changed:
82+
If you filter tests by path, note that the CLI flag has changed: The `--testPathPattern` flag is now `--testPathPatterns`. You can pass multiple patterns by separating them with spaces or by repeating the flag. For example:
8383

84-
- **Configuration:** The `testPathPattern` option (singular) has been replaced by `testPathPatterns` (plural). Instead of a single regex string, this option now takes an array of patterns. For example:
85-
86-
Jest 29 configuration:
87-
88-
```js
89-
export default {
90-
testPathPattern: 'e2e/.*\\.spec\\.js',
91-
};
92-
```
93-
94-
Jest 30 configuration:
95-
96-
```js
97-
export default {
98-
testPathPatterns: ['e2e/.*\\.spec\\.js'],
99-
};
100-
```
101-
102-
Each pattern in the array is treated as a regex or glob to match test file paths.
103-
104-
- **CLI usage:** The `--testPathPattern` flag is now `--testPathPatterns`. You can pass multiple patterns by separating them with spaces or by repeating the flag. For example:
105-
106-
```bash
107-
# Old (Jest 29)
108-
jest --testPathPattern="unit/.*"
84+
```bash
85+
# Old (Jest 29)
86+
jest --testPathPattern="unit/.*"
10987

110-
# New (Jest 30)
111-
jest --testPathPatterns "unit/.*" "integration/.*"
112-
```
88+
# New (Jest 30)
89+
jest --testPathPatterns "unit/.*" "integration/.*"
90+
```
11391

114-
Internally, Jest consolidates these patterns into a `TestPathPatterns` object. If you were programmatically calling Jest’s watch mode with a `testPathPattern`, you must now construct a `TestPathPatterns` instance instead.
92+
Internally, Jest consolidates these patterns into a `TestPathPatterns` object. If you were programmatically calling Jest’s watch mode with a `testPathPattern`, you must now construct a `TestPathPatterns` instance instead.
11593

11694
### Removed `--init` Command
11795

0 commit comments

Comments
 (0)