Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions change/change-004eb4cb-8e33-4be5-a071-5a840aca777c.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
2 changes: 1 addition & 1 deletion packages/just-scripts/etc/just-scripts.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ export interface JestTaskOptions {
silent?: boolean;
// (undocumented)
testNamePattern?: string;
// (undocumented)
testPathPattern?: string;
testPathPatterns?: string;
// (undocumented)
u?: boolean;
// (undocumented)
Expand Down
9 changes: 9 additions & 0 deletions packages/just-scripts/src/tasks/jestTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the type an array or a string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm good question, from what I see in the documentation it looks like multiple strings separated by spaces:
image

I wonder how the parsing of arguments works in that case. Let me look deeper into it and come back with an answer

Copy link
Contributor Author

@An631 An631 Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok so from the documentation I also see that they define the property as a regex expression:

image

https://jestjs.io/docs/cli#--testpathpatternsregex

So I believe using string is the right type based on that.

testNamePattern?: string;
// The maximum number of workers to use in jest for parallel test execution
maxWorkers?: number;
Expand Down Expand Up @@ -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'] : ['']),
Expand Down