jest-preset-angular 9.0.0 → 9.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +73 -31
- package/README.md +0 -1
- package/build/utils/reflect-metadata.js +6 -5
- package/package.json +28 -36
- package/presets/index.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
+
## [9.0.4](https://github.com/thymikee/jest-preset-angular/compare/v9.0.3...v9.0.4) (2021-06-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* widen range for optional webpack dependency ([#955](https://github.com/thymikee/jest-preset-angular/issues/955)) ([b3e8047](https://github.com/thymikee/jest-preset-angular/commit/b3e80475e8e90e4a7ff998c685849d44a1876056))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## [9.0.3](https://github.com/thymikee/jest-preset-angular/compare/v9.0.2...v9.0.3) (2021-06-08)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* add missing `@angular/platform-browser-dynamic` to peer dep ([c1729e4](https://github.com/thymikee/jest-preset-angular/commit/c1729e4c265499ef8cb470e88476410413c25c14))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## [9.0.2](https://github.com/thymikee/jest-preset-angular/compare/v9.0.1...v9.0.2) (2021-06-06)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* allow ESM preset to be used in monorepo structure ([#942](https://github.com/thymikee/jest-preset-angular/issues/942)) ([b402e28](https://github.com/thymikee/jest-preset-angular/commit/b402e2882477d61f8b91cfe39ee5da3b7e1d4381))
|
|
25
|
+
* revert `exports` in `package.json` ([#948](https://github.com/thymikee/jest-preset-angular/issues/948)) ([928e08b](https://github.com/thymikee/jest-preset-angular/commit/928e08bd2077bde98c613e9f47c924a95bec84e7)), closes [/github.com/thymikee/jest-preset-angular/issues/941#issuecomment-854580348](https://github.com//github.com/thymikee/jest-preset-angular/issues/941/issues/issuecomment-854580348)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## [9.0.1](https://github.com/thymikee/jest-preset-angular/compare/v9.0.0...v9.0.1) (2021-05-28)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
|
|
34
|
+
* add missing export `build` in `package.json` ([#936](https://github.com/thymikee/jest-preset-angular/issues/936)) ([b035581](https://github.com/thymikee/jest-preset-angular/commit/b0355814b490758dcdf8a5708524c63d94618014)), closes [#935](https://github.com/thymikee/jest-preset-angular/issues/935)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
1
38
|
# [9.0.0](https://github.com/thymikee/jest-preset-angular/compare/v8.4.0...v9.0.0) (2021-05-27)
|
|
2
39
|
|
|
3
40
|
|
|
@@ -27,14 +64,13 @@
|
|
|
27
64
|
|
|
28
65
|
## BREAKING CHANGES
|
|
29
66
|
|
|
30
|
-
* Drop support for Angular < **
|
|
67
|
+
* Drop support for Angular < **9.0**, see https://angular.io/guide/releases#support-policy-and-schedule.
|
|
31
68
|
* Drop support for Node.js version **10** since it becomes EOL on **2021-04-30**. Required Node version now is **>=12.13.0**.
|
|
32
69
|
* Require **Jest 27**.
|
|
33
|
-
*
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
* By default, if `skipLibCheck` is not defined in tsconfig, `jest-preset-angular` will set it to `true`. If one wants to have it as `false`, one can set explicitly in tsconfig.
|
|
70
|
+
* Users who are using `import 'jest-preset-angular'` should change to `import 'jest-preset-angular/setup-jest'`
|
|
71
|
+
* **transformers:** The AST transformers `InlineFilesTransformer` and `StripStylesTransformer` are **REMOVED** and
|
|
72
|
+
default `jest-preset-angular` uses AST transformers from `@angular/compiler-cli` and `@ngtools/webpack`.
|
|
73
|
+
One should remove the old transformers from the jest config.
|
|
38
74
|
* **compiler:** `jest-preset-angular` now switches to default to use its own transformer which wraps around `ts-jest` to transform codes.
|
|
39
75
|
|
|
40
76
|
Users who are currently doing in jest config
|
|
@@ -58,41 +94,47 @@ module.exports = {
|
|
|
58
94
|
},
|
|
59
95
|
}
|
|
60
96
|
```
|
|
61
|
-
*
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
*
|
|
97
|
+
* **serializers:**: snapshot serializer paths have been changed:
|
|
98
|
+
- `'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js'` is changed to `'jest-preset-angular/build/serializers/no-ng-attributes`.
|
|
99
|
+
- `'jest-preset-angular/build/AngularSnapshotSerializer.js'` is changed to `'jest-preset-angular/build/serializers/ng-snapshot`.
|
|
100
|
+
- `'jest-preset-angular/build/HTMLCommentSerializer.js'` is changed to `'jest-preset-angular/build/serializers/html-comment`.
|
|
101
|
+
* When generating a new project from Angular CLI, by default the `tsconfig.json` doesn't contain any path mappings
|
|
102
|
+
hence removing `moduleNameMapper` from preset will make sure that the preset works in pair with `tsconfig.json`.
|
|
103
|
+
Ones who are relying on the value of `moduleNameMapper` from the preset should create their own `moduleNameMapper`
|
|
104
|
+
config manually or via `ts-jest` util https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping.
|
|
105
|
+
|
|
106
|
+
If you wish to reuse the old configuration of `moduleNameMapper`, you can put this into your Jest config
|
|
66
107
|
```
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
snapshotSerializers: jestPresetAngularSerializers,
|
|
108
|
+
moduleNameMapper: {
|
|
109
|
+
'^src/(.*)$': '<rootDir>/src/$1',
|
|
110
|
+
'^app/(.*)$': '<rootDir>/src/app/$1',
|
|
111
|
+
'^assets/(.*)$': '<rootDir>/src/assets/$1',
|
|
112
|
+
'^environments/(.*)$': '<rootDir>/src/environments/$1',
|
|
73
113
|
}
|
|
74
114
|
```
|
|
75
115
|
|
|
76
|
-
|
|
116
|
+
* By default, if `skipLibCheck` is not defined in tsconfig, `jest-preset-angular` will set it to `true`. If one wants to have it as `false`, one can set explicitly in tsconfig.
|
|
117
|
+
* **compiler:** `jest-preset-angular` now switches to default to use its own transformer which wraps around `ts-jest` to transform codes.
|
|
118
|
+
|
|
119
|
+
Users who are currently doing in jest config
|
|
77
120
|
```
|
|
78
121
|
// jest.config.js
|
|
79
122
|
module.exports = {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
123
|
+
// [...]
|
|
124
|
+
transform: {
|
|
125
|
+
'^.+\\.(ts|js|html)$': 'ts-jest',
|
|
126
|
+
},
|
|
84
127
|
}
|
|
85
128
|
```
|
|
86
|
-
|
|
129
|
+
|
|
130
|
+
should change to
|
|
87
131
|
```
|
|
88
|
-
//
|
|
89
|
-
{
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
]
|
|
95
|
-
}
|
|
132
|
+
// jest.config.js
|
|
133
|
+
module.exports = {
|
|
134
|
+
// [...]
|
|
135
|
+
transform: {
|
|
136
|
+
'^.+\\.(ts|js|html)$': 'jest-preset-angular',
|
|
137
|
+
},
|
|
96
138
|
}
|
|
97
139
|
```
|
|
98
140
|
|
package/README.md
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<a href="https://actions-badge.atrox.dev/thymikee/jest-preset-angular/goto?ref=master"><img alt="Build Status" src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fthymikee%2Fjest-preset-angular%2Fbadge%3Fref%3Dmaster&style=flat-square" /></a>
|
|
7
7
|
<a href="https://www.npmjs.com/package/jest-preset-angular"><img src="https://img.shields.io/npm/v/jest-preset-angular/latest.svg?style=flat-square" alt="NPM Version" /></a>
|
|
8
|
-
<a href="https://www.npmjs.com/package/jest-preset-angular"><img src="https://img.shields.io/npm/v/jest-preset-angular/next.svg?style=flat-square" alt="NPM Version" /></a>
|
|
9
8
|
<a href="https://github.com/thymikee/jest-preset-angular/blob/master/LICENSE"><img src="https://img.shields.io/npm/l/jest-preset-angular.svg?style=flat-square" alt="GitHub license" /></a>
|
|
10
9
|
</p>
|
|
11
10
|
|
|
@@ -5,11 +5,12 @@ const globalRef = globalThis || global;
|
|
|
5
5
|
const reflect = globalRef['Reflect'];
|
|
6
6
|
const metadataValueStore = new WeakMap();
|
|
7
7
|
if (!reflect.metadata && !reflect.getOwnMetadata) {
|
|
8
|
-
reflect.metadata =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
reflect.metadata =
|
|
9
|
+
(metadataKey, metadataValue) => (target, key) => {
|
|
10
|
+
if (metadataKey === METADATA_KEY_PARAMTYPES && key === undefined) {
|
|
11
|
+
metadataValueStore.set(target, metadataValue);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
13
14
|
reflect.getOwnMetadata = (metadata, target, key) => {
|
|
14
15
|
if (metadata === METADATA_KEY_PARAMTYPES && key === undefined && metadataValueStore.has(target)) {
|
|
15
16
|
return metadataValueStore.get(target);
|
package/package.json
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jest-preset-angular",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.4",
|
|
4
4
|
"description": "Jest preset configuration for Angular projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "build/index.js",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": "./dist/index.js",
|
|
9
|
-
"./presets": "./presets/index.js",
|
|
10
|
-
"./jest-preset": "./jest-preset.js",
|
|
11
|
-
"./setup-jest": "./setup-jest.js",
|
|
12
|
-
"./ngcc-jest-processor": "./ngcc-jest-processor.js",
|
|
13
|
-
"./package.json": "./package.json"
|
|
14
|
-
},
|
|
15
7
|
"repository": {
|
|
16
8
|
"type": "git",
|
|
17
9
|
"url": "git+https://github.com/thymikee/jest-preset-angular.git"
|
|
@@ -39,7 +31,7 @@
|
|
|
39
31
|
"lint:fix": "eslint --fix --ext .js,.ts .",
|
|
40
32
|
"lint:prettier": "prettier '**/*.{yml,yaml}' 'website/**/*.{css,js,md}' 'README.md' --write --ignore-path .gitignore",
|
|
41
33
|
"lint:prettier-ci": "prettier '**/*.{yml,yaml}' 'website/**/*.{css,js,md}' 'README.md' --check --ignore-path .gitignore",
|
|
42
|
-
"test": "
|
|
34
|
+
"test": "jest",
|
|
43
35
|
"test:examples": "node scripts/test-examples.js",
|
|
44
36
|
"doc": "cd website && yarn start",
|
|
45
37
|
"doc:build": "cd website && yarn build",
|
|
@@ -56,47 +48,47 @@
|
|
|
56
48
|
"peerDependencies": {
|
|
57
49
|
"@angular-devkit/build-angular": ">=0.901.12",
|
|
58
50
|
"@angular/core": ">=9.0.0",
|
|
51
|
+
"@angular/platform-browser-dynamic": ">=9.0.0",
|
|
59
52
|
"jest": "^27.0.0"
|
|
60
53
|
},
|
|
61
54
|
"optionalDependencies": {
|
|
62
|
-
"webpack": "5.
|
|
55
|
+
"webpack": "^4.0.0 || ^5.30.0"
|
|
63
56
|
},
|
|
64
57
|
"devDependencies": {
|
|
65
|
-
"@angular-devkit/build-angular": "^0.1102.
|
|
66
|
-
"@angular/
|
|
67
|
-
"@angular/
|
|
68
|
-
"@angular/compiler": "^11.2.
|
|
69
|
-
"@angular/
|
|
70
|
-
"@angular/
|
|
71
|
-
"@angular/platform-browser": "^11.2.
|
|
72
|
-
"@
|
|
73
|
-
"@commitlint/
|
|
74
|
-
"@
|
|
75
|
-
"@jest/
|
|
76
|
-
"@jest/
|
|
77
|
-
"@jest/types": "^27.0.1",
|
|
58
|
+
"@angular-devkit/build-angular": "^0.1102.14",
|
|
59
|
+
"@angular/common": "^11.2.14",
|
|
60
|
+
"@angular/compiler": "^11.2.14",
|
|
61
|
+
"@angular/compiler-cli": "^11.2.14",
|
|
62
|
+
"@angular/core": "^11.2.14",
|
|
63
|
+
"@angular/platform-browser": "^11.2.14",
|
|
64
|
+
"@angular/platform-browser-dynamic": "^11.2.14",
|
|
65
|
+
"@commitlint/cli": "^12.1.4",
|
|
66
|
+
"@commitlint/config-angular": "^12.1.4",
|
|
67
|
+
"@jest/globals": "^27.0.3",
|
|
68
|
+
"@jest/transform": "^27.0.2",
|
|
69
|
+
"@jest/types": "^27.0.2",
|
|
78
70
|
"@types/jest": "^26.0.23",
|
|
79
|
-
"@types/node": "^14.
|
|
80
|
-
"@types/semver": "^7.3.
|
|
81
|
-
"@typescript-eslint/eslint-plugin": "^4.
|
|
82
|
-
"@typescript-eslint/parser": "^4.
|
|
71
|
+
"@types/node": "^14.17.3",
|
|
72
|
+
"@types/semver": "^7.3.6",
|
|
73
|
+
"@typescript-eslint/eslint-plugin": "^4.26.1",
|
|
74
|
+
"@typescript-eslint/parser": "^4.26.1",
|
|
83
75
|
"conventional-changelog-cli": "^2.1.1",
|
|
84
|
-
"eslint": "^7.
|
|
76
|
+
"eslint": "^7.28.0",
|
|
85
77
|
"eslint-config-prettier": "^8.3.0",
|
|
86
|
-
"eslint-plugin-import": "^2.
|
|
78
|
+
"eslint-plugin-import": "^2.23.4",
|
|
87
79
|
"eslint-plugin-jest": "^24.3.6",
|
|
88
|
-
"eslint-plugin-jsdoc": "^
|
|
80
|
+
"eslint-plugin-jsdoc": "^35.1.3",
|
|
89
81
|
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
90
82
|
"eslint-plugin-prettier": "^3.4.0",
|
|
91
|
-
"execa": "^5.
|
|
92
|
-
"glob": "^7.1.
|
|
83
|
+
"execa": "^5.1.1",
|
|
84
|
+
"glob": "^7.1.7",
|
|
93
85
|
"glob-gitignore": "^1.0.14",
|
|
94
86
|
"husky": "^6.0.0",
|
|
95
|
-
"jest": "^27.0.
|
|
87
|
+
"jest": "^27.0.4",
|
|
96
88
|
"jest-snapshot-serializer-raw": "^1.2.0",
|
|
97
|
-
"lint-staged": "^
|
|
89
|
+
"lint-staged": "^11.0.0",
|
|
98
90
|
"pinst": "^2.1.6",
|
|
99
|
-
"prettier": "^2.
|
|
91
|
+
"prettier": "^2.3.1",
|
|
100
92
|
"rxjs": "^6.6.7",
|
|
101
93
|
"tslib": "^2.2.0",
|
|
102
94
|
"typescript": "~4.1.5",
|