diff --git a/change/change-004eb4cb-8e33-4be5-a071-5a840aca777c.json b/change/change-004eb4cb-8e33-4be5-a071-5a840aca777c.json new file mode 100644 index 00000000..fda853a4 --- /dev/null +++ b/change/change-004eb4cb-8e33-4be5-a071-5a840aca777c.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "type": "minor", + "comment": "Adding support for jest 30 testNamePatterns (plural) option", + "packageName": "just-scripts", + "email": "email not defined", + "dependentChangeType": "patch" + } + ] +} \ No newline at end of file diff --git a/packages/just-scripts/etc/just-scripts.api.md b/packages/just-scripts/etc/just-scripts.api.md index 234aa705..6bd5630a 100644 --- a/packages/just-scripts/etc/just-scripts.api.md +++ b/packages/just-scripts/etc/just-scripts.api.md @@ -278,8 +278,8 @@ export interface JestTaskOptions { silent?: boolean; // (undocumented) testNamePattern?: string; - // (undocumented) testPathPattern?: string; + testPathPatterns?: string; // (undocumented) u?: boolean; // (undocumented) diff --git a/packages/just-scripts/src/tasks/jestTask.ts b/packages/just-scripts/src/tasks/jestTask.ts index c1a93521..f3788293 100644 --- a/packages/just-scripts/src/tasks/jestTask.ts +++ b/packages/just-scripts/src/tasks/jestTask.ts @@ -14,7 +14,15 @@ export interface JestTaskOptions { passWithNoTests?: boolean; clearCache?: boolean; silent?: boolean; + /** + * This is not available in jest 30+ + * Consider updating to jest 30 and using testPathPatterns (plural) instead. + */ testPathPattern?: string; + /** + * Compatible with jest 30+ only + */ + testPathPatterns?: string; testNamePattern?: string; // The maximum number of workers to use in jest for parallel test execution maxWorkers?: number; @@ -71,6 +79,7 @@ export function jestTask(options: JestTaskOptions = {}): TaskFunction { ...(options.watch ? ['--watch'] : []), ...(options.silent ? ['--silent'] : []), ...(options.testPathPattern ? ['--testPathPattern', options.testPathPattern] : []), + ...(options.testPathPatterns ? ['--testPathPatterns', options.testPathPatterns] : []), ...(options.testNamePattern ? ['--testNamePattern', options.testNamePattern] : []), ...(options.maxWorkers ? ['--maxWorkers', options.maxWorkers] : []), ...(options.u || options.updateSnapshot ? ['--updateSnapshot'] : ['']),