From 6b496b1b29eeb70ef0c0a506b03f6cf0fed71c7b Mon Sep 17 00:00:00 2001 From: Joe Lencioni Date: Thu, 5 Jun 2025 13:19:32 -0500 Subject: [PATCH] Remove testPathPatterns Jest config details from v30 upgrade guide It seems that this is only a CLI option, and not supported in the Jest config file, so we shouldn't include those details in this upgrade guide. More details in https://github.com/jestjs/jest/issues/15645 --- docs/UpgradingToJest30.md | 40 +++++++++------------------------------ 1 file changed, 9 insertions(+), 31 deletions(-) diff --git a/docs/UpgradingToJest30.md b/docs/UpgradingToJest30.md index 8c453f2c01e7..8985c17928ff 100644 --- a/docs/UpgradingToJest30.md +++ b/docs/UpgradingToJest30.md @@ -77,41 +77,19 @@ If your project contains files with these extensions that are **not** intended t ::: -### `testPathPattern` Renamed to `testPathPatterns` +### `--testPathPattern` Renamed to `--testPathPatterns` -If you filter tests by path, note that the configuration option and CLI flag have changed: +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: -- **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: - - Jest 29 configuration: - - ```js - export default { - testPathPattern: 'e2e/.*\\.spec\\.js', - }; - ``` - - Jest 30 configuration: - - ```js - export default { - testPathPatterns: ['e2e/.*\\.spec\\.js'], - }; - ``` - - Each pattern in the array is treated as a regex or glob to match test file paths. - -- **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: - - ```bash - # Old (Jest 29) - jest --testPathPattern="unit/.*" +```bash +# Old (Jest 29) +jest --testPathPattern="unit/.*" - # New (Jest 30) - jest --testPathPatterns "unit/.*" "integration/.*" - ``` +# New (Jest 30) +jest --testPathPatterns "unit/.*" "integration/.*" +``` - 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. +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. ### Removed `--init` Command