Skip to content

Commit

Permalink
Add deprecation error for --testPathPattern
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonchinn178 committed Sep 25, 2023
1 parent 042fddd commit a52fc2f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/jest-config/src/Deprecated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
import chalk = require('chalk');
import type {DeprecatedOptions} from 'jest-validate';

function formatDeprecation(message: string): string {
const lines = [
message.replace(/\*(.+?)\*/g, (_, s) => chalk.bold(`"${s}"`)),
'',
'Please update your configuration.',
];
return lines.map(s => ` ${s}`).join('\n');
}

const deprecatedOptions: DeprecatedOptions = {
browser: () =>
` Option ${chalk.bold(
Expand Down Expand Up @@ -78,6 +87,11 @@ const deprecatedOptions: DeprecatedOptions = {
Please update your configuration.
`,

testPathPattern: () =>
formatDeprecation(
'Option *testPathPattern* was replaced by *testPathPatterns*.',
),

testURL: (_options: {testURL?: string}) => ` Option ${chalk.bold(
'"testURL"',
)} was replaced by passing the URL via ${chalk.bold(
Expand Down

0 comments on commit a52fc2f

Please sign in to comment.