Skip to content

Commit bf3fc41

Browse files
leosvelperezFrozenPandaz
authored andcommitted
fix(testing): fix generated testMatch pattern in jest config to support windows (#15415)
(cherry picked from commit 5e12d05)
1 parent 87b1a73 commit bf3fc41

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

packages/jest/src/generators/jest-project/files-angular/jest.config.ts__tmpl__

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
]<% } %><% if(rootProject){ %>,
2323
testMatch: [
2424
'<rootDir>/src/**/__tests__/**/*.[jt]s?(x)',
25-
'<rootDir>/src/**/?(*.)+(spec|test).[jt]s?(x)',
25+
'<rootDir>/src/**/*(*.)@(spec|test).[jt]s?(x)',
2626
],<% } %>
2727
};

packages/jest/src/generators/jest-project/files/jest.config.ts__tmpl__

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
coverageDirectory: '<%= offsetFromRoot %>coverage/<%= projectRoot %>'<% if(rootProject){ %>,
1212
testMatch: [
1313
'<rootDir>/src/**/__tests__/**/*.[jt]s?(x)',
14-
'<rootDir>/src/**/?(*.)+(spec|test).[jt]s?(x)',
14+
'<rootDir>/src/**/*(*.)@(spec|test).[jt]s?(x)',
1515
],<% } %>
1616
};

packages/jest/src/generators/jest-project/jest-project.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ describe('jestProject', () => {
388388
coverageDirectory: './coverage/my-project',
389389
testMatch: [
390390
'<rootDir>/src/**/__tests__/**/*.[jt]s?(x)',
391-
'<rootDir>/src/**/?(*.)+(spec|test).[jt]s?(x)',
391+
'<rootDir>/src/**/*(*.)@(spec|test).[jt]s?(x)',
392392
],
393393
};
394394
"
@@ -421,7 +421,7 @@ describe('jestProject', () => {
421421
coverageDirectory: './coverage/my-project',
422422
testMatch: [
423423
'<rootDir>/src/**/__tests__/**/*.[jt]s?(x)',
424-
'<rootDir>/src/**/?(*.)+(spec|test).[jt]s?(x)',
424+
'<rootDir>/src/**/*(*.)@(spec|test).[jt]s?(x)',
425425
],
426426
};
427427
"

packages/nx/src/nx-init/add-nx-to-nest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ function getJestOptions(
281281
delete jestOptions['testRegex'];
282282
jestOptions['testMatch'] = isE2E
283283
? ['<rootDir>/test/**/?(*.)+(e2e-spec|e2e-test).[jt]s?(x)']
284-
: ['<rootDir>/src/**/?(*.)+(spec|test).[jt]s?(x)'];
284+
: ['<rootDir>/src/**/*(*.)@(spec|test).[jt]s?(x)'];
285285

286286
// set coverage directory for unit test
287287
if (!isE2E) {

0 commit comments

Comments
 (0)