Skip to content

Commit cf872b5

Browse files
committedApr 6, 2023
chore: [nx migration] update-configs-jest-29
1 parent e6788fa commit cf872b5

File tree

4 files changed

+36
-21
lines changed

4 files changed

+36
-21
lines changed
 

‎apps/ng-web/jest.config.ts

+8-7
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ export default {
33
displayName: 'web',
44

55
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
6-
globals: {
7-
'ts-jest': {
8-
tsconfig: '<rootDir>/tsconfig.spec.json',
9-
stringifyContentPathRegex: '\\.(html|svg)$',
10-
},
11-
},
6+
globals: {},
127
coverageDirectory: '../../coverage/apps/web',
138
transform: {
14-
'^.+.(ts|mjs|js|html)$': 'jest-preset-angular',
9+
'^.+.(ts|mjs|js|html)$': [
10+
'jest-preset-angular',
11+
{
12+
tsconfig: '<rootDir>/tsconfig.spec.json',
13+
stringifyContentPathRegex: '\\.(html|svg)$',
14+
},
15+
],
1516
},
1617
transformIgnorePatterns: ['node_modules/(?!.*.mjs$)'],
1718
snapshotSerializers: [

‎jest.preset.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
11
const nxPreset = require('@nrwl/jest/preset').default;
22

3-
module.exports = { ...nxPreset };
3+
module.exports = {
4+
...nxPreset,
5+
/* TODO: Update to latest Jest snapshotFormat
6+
* By default Nx has kept the older style of Jest Snapshot formats
7+
* to prevent breaking of any existing tests with snapshots.
8+
* It's recommend you update to the latest format.
9+
* You can do this by removing snapshotFormat property
10+
* and running tests with --update-snapshot flag.
11+
* Example: "nx affected --targets=test --update-snapshot"
12+
* More info: https://jestjs.io/docs/upgrading-to-jest29#snapshot-format
13+
*/
14+
snapshotFormat: { escapeString: true, printBasicPrototype: true },
15+
};

‎libs/effects-ng/jest.config.ts

+8-7
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ export default {
33
displayName: 'effects-ng',
44

55
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
6-
globals: {
7-
'ts-jest': {
8-
tsconfig: '<rootDir>/tsconfig.spec.json',
9-
stringifyContentPathRegex: '\\.(html|svg)$',
10-
},
11-
},
6+
globals: {},
127
coverageDirectory: '../../coverage/libs/effects-ng',
138
transform: {
14-
'^.+.(ts|mjs|js|html)$': 'jest-preset-angular',
9+
'^.+.(ts|mjs|js|html)$': [
10+
'jest-preset-angular',
11+
{
12+
tsconfig: '<rootDir>/tsconfig.spec.json',
13+
stringifyContentPathRegex: '\\.(html|svg)$',
14+
},
15+
],
1516
},
1617
transformIgnorePatterns: ['node_modules/(?!.*.mjs$)'],
1718
snapshotSerializers: [

‎libs/effects/jest.config.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
export default {
33
displayName: 'effects',
44

5-
globals: {
6-
'ts-jest': {
7-
tsconfig: '<rootDir>/tsconfig.spec.json',
8-
},
9-
},
5+
globals: {},
106
transform: {
11-
'^.+\\.[tj]sx?$': 'ts-jest',
7+
'^.+\\.[tj]sx?$': [
8+
'ts-jest',
9+
{
10+
tsconfig: '<rootDir>/tsconfig.spec.json',
11+
},
12+
],
1213
},
1314
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
1415
coverageDirectory: '../../coverage/libs/effects',

0 commit comments

Comments
 (0)
Please sign in to comment.