Skip to content

Commit

Permalink
fix(testing): fix generated testMatch pattern in jest config to suppo…
Browse files Browse the repository at this point in the history
…rt windows (#15415)

(cherry picked from commit 5e12d05)
  • Loading branch information
leosvelperez authored and FrozenPandaz committed Mar 3, 2023
1 parent 87b1a73 commit bf3fc41
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
]<% } %><% if(rootProject){ %>,
testMatch: [
'<rootDir>/src/**/__tests__/**/*.[jt]s?(x)',
'<rootDir>/src/**/?(*.)+(spec|test).[jt]s?(x)',
'<rootDir>/src/**/*(*.)@(spec|test).[jt]s?(x)',
],<% } %>
};
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
coverageDirectory: '<%= offsetFromRoot %>coverage/<%= projectRoot %>'<% if(rootProject){ %>,
testMatch: [
'<rootDir>/src/**/__tests__/**/*.[jt]s?(x)',
'<rootDir>/src/**/?(*.)+(spec|test).[jt]s?(x)',
'<rootDir>/src/**/*(*.)@(spec|test).[jt]s?(x)',
],<% } %>
};
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ describe('jestProject', () => {
coverageDirectory: './coverage/my-project',
testMatch: [
'<rootDir>/src/**/__tests__/**/*.[jt]s?(x)',
'<rootDir>/src/**/?(*.)+(spec|test).[jt]s?(x)',
'<rootDir>/src/**/*(*.)@(spec|test).[jt]s?(x)',
],
};
"
Expand Down Expand Up @@ -421,7 +421,7 @@ describe('jestProject', () => {
coverageDirectory: './coverage/my-project',
testMatch: [
'<rootDir>/src/**/__tests__/**/*.[jt]s?(x)',
'<rootDir>/src/**/?(*.)+(spec|test).[jt]s?(x)',
'<rootDir>/src/**/*(*.)@(spec|test).[jt]s?(x)',
],
};
"
Expand Down
2 changes: 1 addition & 1 deletion packages/nx/src/nx-init/add-nx-to-nest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ function getJestOptions(
delete jestOptions['testRegex'];
jestOptions['testMatch'] = isE2E
? ['<rootDir>/test/**/?(*.)+(e2e-spec|e2e-test).[jt]s?(x)']
: ['<rootDir>/src/**/?(*.)+(spec|test).[jt]s?(x)'];
: ['<rootDir>/src/**/*(*.)@(spec|test).[jt]s?(x)'];

// set coverage directory for unit test
if (!isE2E) {
Expand Down

0 comments on commit bf3fc41

Please sign in to comment.