Skip to content

Commit a52fc2f

Browse files
Add deprecation error for --testPathPattern
1 parent 042fddd commit a52fc2f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

packages/jest-config/src/Deprecated.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88
import chalk = require('chalk');
99
import type {DeprecatedOptions} from 'jest-validate';
1010

11+
function formatDeprecation(message: string): string {
12+
const lines = [
13+
message.replace(/\*(.+?)\*/g, (_, s) => chalk.bold(`"${s}"`)),
14+
'',
15+
'Please update your configuration.',
16+
];
17+
return lines.map(s => ` ${s}`).join('\n');
18+
}
19+
1120
const deprecatedOptions: DeprecatedOptions = {
1221
browser: () =>
1322
` Option ${chalk.bold(
@@ -78,6 +87,11 @@ const deprecatedOptions: DeprecatedOptions = {
7887
Please update your configuration.
7988
`,
8089

90+
testPathPattern: () =>
91+
formatDeprecation(
92+
'Option *testPathPattern* was replaced by *testPathPatterns*.',
93+
),
94+
8195
testURL: (_options: {testURL?: string}) => ` Option ${chalk.bold(
8296
'"testURL"',
8397
)} was replaced by passing the URL via ${chalk.bold(

0 commit comments

Comments
 (0)