Skip to content

Commit 12b7ebe

Browse files
authored
ci: 🎡 upgrade to jest v29 (#603)
* ci: 🎡 upgrade to jest v29
1 parent 8e34981 commit 12b7ebe

File tree

4 files changed

+884
-550
lines changed

4 files changed

+884
-550
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"@commitlint/config-angular": "17.3.0",
5656
"@commitlint/config-conventional": "17.3.0",
5757
"@types/jasmine": "3.8.1",
58-
"@types/jest": "26.0.24",
58+
"@types/jest": "29.5.0",
5959
"@types/node": "16.3.1",
6060
"@typescript-eslint/eslint-plugin": "^5.43.0",
6161
"@typescript-eslint/parser": "^5.43.0",
@@ -69,8 +69,8 @@
6969
"husky": "^8.0.2",
7070
"jasmine-core": "3.8.0",
7171
"jasmine-spec-reporter": "7.0.0",
72-
"jest": "28.0.0",
73-
"jest-preset-angular": "12.2.3",
72+
"jest": "29.5.0",
73+
"jest-preset-angular": "13.0.1",
7474
"karma": "6.3.4",
7575
"karma-chrome-launcher": "3.1.0",
7676
"karma-coverage-istanbul-reporter": "3.0.3",
@@ -95,4 +95,4 @@
9595
"prettier --write"
9696
]
9797
}
98-
}
98+
}

projects/spectator/jest.config.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
const { defaultTransformerOptions } = require('jest-preset-angular/presets');
2+
13
module.exports = {
2-
preset: 'jest-preset-angular',
3-
globals: {
4-
'ts-jest': {
5-
tsconfig: 'projects/spectator/jest/tsconfig.spec.json'
6-
}
4+
transform: {
5+
'^.+\\.(ts|js|mjs|html|svg)$': [
6+
'jest-preset-angular',
7+
{
8+
...defaultTransformerOptions,
9+
tsconfig: 'projects/spectator/jest/tsconfig.spec.json',
10+
isolatedModules: true,
11+
},
12+
],
713
},
814
roots: ['projects/spectator'],
915
testMatch: ['**/jest/**/*.spec.ts'],

projects/spectator/jest/src/lib/mock.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { FactoryProvider, AbstractType, Type } from '@angular/core';
44
import { installProtoMethods, CompatibleSpy, SpyObject as BaseSpyObject } from '@ngneat/spectator';
55
import { jest } from '@jest/globals';
66

7-
export type SpyObject<T> = BaseSpyObject<T> & { [P in keyof T]: T[P] & (T[P] extends (...args: any[]) => infer R ? jest.Mock<R> : T[P]) };
7+
export type SpyObject<T> = BaseSpyObject<T> &
8+
{ [P in keyof T]: T[P] & (T[P] extends (...args: any[]) => infer R ? (R extends (...args: any[]) => any ? jest.Mock<R> : T[P]) : T[P]) };
89

910
/**
1011
* @publicApi

0 commit comments

Comments
 (0)