jest-preset-angular 9.0.0-next.9 → 9.0.3
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 +179 -107
- package/README.md +25 -5
- package/build/config/setup-jest.js +4 -2
- package/build/index.js +3 -5
- package/build/transformers/replace-resources.js +47 -23
- package/package.json +54 -55
- package/presets/index.js +5 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,132 +1,262 @@
|
|
|
1
|
-
|
|
1
|
+
## [9.0.3](https://github.com/thymikee/jest-preset-angular/compare/v9.0.2...v9.0.3) (2021-06-08)
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
###
|
|
4
|
+
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
*
|
|
6
|
+
* add missing `@angular/platform-browser-dynamic` to peer dep ([c1729e4](https://github.com/thymikee/jest-preset-angular/commit/c1729e4c265499ef8cb470e88476410413c25c14))
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## [9.0.2](https://github.com/thymikee/jest-preset-angular/compare/v9.0.1...v9.0.2) (2021-06-06)
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
###
|
|
13
|
+
### Bug Fixes
|
|
14
14
|
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* include features from `ts-jest` **27.0.0-next.6**
|
|
15
|
+
* 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))
|
|
16
|
+
* 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)
|
|
18
17
|
|
|
19
18
|
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
## [9.0.1](https://github.com/thymikee/jest-preset-angular/compare/v9.0.0...v9.0.1) (2021-05-28)
|
|
22
21
|
|
|
23
22
|
|
|
24
23
|
### Bug Fixes
|
|
25
24
|
|
|
26
|
-
*
|
|
25
|
+
* 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)
|
|
27
26
|
|
|
28
27
|
|
|
29
|
-
### Features
|
|
30
28
|
|
|
31
|
-
|
|
29
|
+
# [9.0.0](https://github.com/thymikee/jest-preset-angular/compare/v8.4.0...v9.0.0) (2021-05-27)
|
|
32
30
|
|
|
33
31
|
|
|
32
|
+
### Bug Fixes
|
|
34
33
|
|
|
35
|
-
|
|
34
|
+
* support all node versions >= **12.13.0** ([#923](https://github.com/thymikee/jest-preset-angular/issues/923)) ([96782a6](https://github.com/thymikee/jest-preset-angular/commit/96782a652821864576aa1cb96e57a39187172dd4)), closes [#920](https://github.com/thymikee/jest-preset-angular/issues/920)
|
|
35
|
+
* **presets:** remove `moduleNameMapper` config ([#910](https://github.com/thymikee/jest-preset-angular/issues/910)) ([df482bc](https://github.com/thymikee/jest-preset-angular/commit/df482bcb4c99b441f2fef8def04d10b8a1188deb)), closes [#908](https://github.com/thymikee/jest-preset-angular/issues/908)
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
### Features
|
|
39
39
|
|
|
40
|
-
*
|
|
41
|
-
* **
|
|
40
|
+
* support **Jest 27** ([#926](https://github.com/thymikee/jest-preset-angular/issues/926)) ([1c761f8](https://github.com/thymikee/jest-preset-angular/commit/1c761f873686a96edeb4c3cb2f184d8a88f5f52a))
|
|
41
|
+
* **config:** load zone ESM when running jest in ESM mode ([#892](https://github.com/thymikee/jest-preset-angular/issues/892)) ([e03ec19](https://github.com/thymikee/jest-preset-angular/commit/e03ec19c30b6ff257d0ddd7a8783d65ed5f43f8e)), closes [#751](https://github.com/thymikee/jest-preset-angular/issues/751)
|
|
42
|
+
* add `exports` field to `package.json`, see https://nodejs.org/api/packages.html#packages_package_entry_points
|
|
43
|
+
* **presets:** add type definition for `presets` entry point ([#801](https://github.com/thymikee/jest-preset-angular/issues/801)) ([e4ff0c0](https://github.com/thymikee/jest-preset-angular/commit/e4ff0c0e19e5941e7e7db1da9b5c29e01d58ab58))
|
|
44
|
+
* **compiler:** support ESM ([#721](https://github.com/thymikee/jest-preset-angular/issues/721)) ([a2166f8](https://github.com/thymikee/jest-preset-angular/commit/a2166f859b1c89340ee889520595d05fa3cf65dc))
|
|
42
45
|
* **presets:** add ESM preset ([#723](https://github.com/thymikee/jest-preset-angular/issues/723)) ([b0073b0](https://github.com/thymikee/jest-preset-angular/commit/b0073b0f3a7e24f06d136367a1c2e676ac76e59e))
|
|
46
|
+
* **compiler:** use `replace-resources` AST transformer from Angular ([#708](https://github.com/thymikee/jest-preset-angular/issues/708)) ([1b20c19](https://github.com/thymikee/jest-preset-angular/commit/1b20c196586487a119f7e5e545c2a7fcfe6359fb))
|
|
47
|
+
* **compiler:** use `downlevel-ctor` AST transformer from Angular ([#730](https://github.com/thymikee/jest-preset-angular/issues/730)) ([1f964c3](https://github.com/thymikee/jest-preset-angular/commit/c1242868557a95d79a7bb5a108153496e1f964c3))
|
|
43
48
|
|
|
44
49
|
|
|
50
|
+
### Performance Improvements
|
|
45
51
|
|
|
46
|
-
|
|
52
|
+
* **compiler:** reuse `cacheFS` from jest to reduce file system reading ([#679](https://github.com/thymikee/jest-preset-angular/issues/679)) ([f5d9d4b](https://github.com/thymikee/jest-preset-angular/commit/f5d9d4b9c0b5440ab14ddb4a636ea84d384e3408))
|
|
53
|
+
* **config:** set `skipLibCheck: true` if not defined in tsconfig ([#678](https://github.com/thymikee/jest-preset-angular/issues/678)) ([0df3ce1](https://github.com/thymikee/jest-preset-angular/commit/0df3ce159c6778893dc08e35bdb99d0f3e0285b5))
|
|
47
54
|
|
|
48
55
|
|
|
49
|
-
|
|
56
|
+
## BREAKING CHANGES
|
|
50
57
|
|
|
51
|
-
*
|
|
52
|
-
* **
|
|
58
|
+
* Drop support for Angular < **9.0**, see https://angular.io/guide/releases#support-policy-and-schedule.
|
|
59
|
+
* Drop support for Node.js version **10** since it becomes EOL on **2021-04-30**. Required Node version now is **>=12.13.0**.
|
|
60
|
+
* Require **Jest 27**.
|
|
61
|
+
* Users who are using `import 'jest-preset-angular'` should change to `import 'jest-preset-angular/setup-jest'`
|
|
62
|
+
* **transformers:** The AST transformers `InlineFilesTransformer` and `StripStylesTransformer` are **REMOVED** and
|
|
63
|
+
default `jest-preset-angular` uses AST transformers from `@angular/compiler-cli` and `@ngtools/webpack`.
|
|
64
|
+
One should remove the old transformers from the jest config.
|
|
65
|
+
* **compiler:** `jest-preset-angular` now switches to default to use its own transformer which wraps around `ts-jest` to transform codes.
|
|
53
66
|
|
|
67
|
+
Users who are currently doing in jest config
|
|
68
|
+
```
|
|
69
|
+
// jest.config.js
|
|
70
|
+
module.exports = {
|
|
71
|
+
// [...]
|
|
72
|
+
transform: {
|
|
73
|
+
'^.+\\.(ts|js|html)$': 'ts-jest',
|
|
74
|
+
},
|
|
75
|
+
}
|
|
76
|
+
```
|
|
54
77
|
|
|
55
|
-
|
|
78
|
+
should change to
|
|
79
|
+
```
|
|
80
|
+
// jest.config.js
|
|
81
|
+
module.exports = {
|
|
82
|
+
// [...]
|
|
83
|
+
transform: {
|
|
84
|
+
'^.+\\.(ts|js|html)$': 'jest-preset-angular',
|
|
85
|
+
},
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
* **serializers:**: snapshot serializer paths have been changed:
|
|
89
|
+
- `'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js'` is changed to `'jest-preset-angular/build/serializers/no-ng-attributes`.
|
|
90
|
+
- `'jest-preset-angular/build/AngularSnapshotSerializer.js'` is changed to `'jest-preset-angular/build/serializers/ng-snapshot`.
|
|
91
|
+
- `'jest-preset-angular/build/HTMLCommentSerializer.js'` is changed to `'jest-preset-angular/build/serializers/html-comment`.
|
|
92
|
+
* When generating a new project from Angular CLI, by default the `tsconfig.json` doesn't contain any path mappings
|
|
93
|
+
hence removing `moduleNameMapper` from preset will make sure that the preset works in pair with `tsconfig.json`.
|
|
94
|
+
Ones who are relying on the value of `moduleNameMapper` from the preset should create their own `moduleNameMapper`
|
|
95
|
+
config manually or via `ts-jest` util https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping.
|
|
96
|
+
|
|
97
|
+
If you wish to reuse the old configuration of `moduleNameMapper`, you can put this into your Jest config
|
|
98
|
+
```
|
|
99
|
+
moduleNameMapper: {
|
|
100
|
+
'^src/(.*)$': '<rootDir>/src/$1',
|
|
101
|
+
'^app/(.*)$': '<rootDir>/src/app/$1',
|
|
102
|
+
'^assets/(.*)$': '<rootDir>/src/assets/$1',
|
|
103
|
+
'^environments/(.*)$': '<rootDir>/src/environments/$1',
|
|
104
|
+
}
|
|
105
|
+
```
|
|
56
106
|
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* For users who migrate from **v8.3.2** to **9.0.0**, any references to `'jest-preset-angular/build/InlineFilesTransformer'` and `'jest-preset-angular/build/StripStylesTransformer'` should be removed from jest config.
|
|
60
|
-
* For users who migrate from **9.0.0-next.4**, any references to `jest-preset-angular/build/transformers/inline-files` and `jest-preset-angular/build/transformers/inline-files` should be removed from jest config.
|
|
107
|
+
* 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.
|
|
108
|
+
* **compiler:** `jest-preset-angular` now switches to default to use its own transformer which wraps around `ts-jest` to transform codes.
|
|
61
109
|
|
|
110
|
+
Users who are currently doing in jest config
|
|
111
|
+
```
|
|
112
|
+
// jest.config.js
|
|
113
|
+
module.exports = {
|
|
114
|
+
// [...]
|
|
115
|
+
transform: {
|
|
116
|
+
'^.+\\.(ts|js|html)$': 'ts-jest',
|
|
117
|
+
},
|
|
118
|
+
}
|
|
119
|
+
```
|
|
62
120
|
|
|
121
|
+
should change to
|
|
122
|
+
```
|
|
123
|
+
// jest.config.js
|
|
124
|
+
module.exports = {
|
|
125
|
+
// [...]
|
|
126
|
+
transform: {
|
|
127
|
+
'^.+\\.(ts|js|html)$': 'jest-preset-angular',
|
|
128
|
+
},
|
|
129
|
+
}
|
|
130
|
+
```
|
|
63
131
|
|
|
64
|
-
# [9.0.0-next.4](https://github.com/thymikee/jest-preset-angular/compare/v9.0.0-next.0...v9.0.0-next.4) (2020-12-18)
|
|
65
132
|
|
|
66
133
|
|
|
67
|
-
|
|
134
|
+
# [9.0.0-next.14](https://github.com/thymikee/jest-preset-angular/compare/v9.0.0-next.13...v9.0.0-next.14) (2021-05-05)
|
|
68
135
|
|
|
69
|
-
* **devs-infra:** build package with target `es2015` ([#620](https://github.com/thymikee/jest-preset-angular/issues/620)) ([779fd8c](https://github.com/thymikee/jest-preset-angular/commit/779fd8c2f878d21587e24eda4121dc73166dfa53))
|
|
70
136
|
|
|
137
|
+
### Bug Fixes
|
|
71
138
|
|
|
72
|
-
|
|
139
|
+
* **presets:** remove `moduleNameMapper` config ([#910](https://github.com/thymikee/jest-preset-angular/issues/910)) ([df482bc](https://github.com/thymikee/jest-preset-angular/commit/df482bcb4c99b441f2fef8def04d10b8a1188deb)), closes [#908](https://github.com/thymikee/jest-preset-angular/issues/908)
|
|
73
140
|
|
|
74
|
-
* support Jest 27 ([#676](https://github.com/thymikee/jest-preset-angular/issues/676)) ([1a6b10e](https://github.com/thymikee/jest-preset-angular/commit/1a6b10ef66c266a7736f2ef4aed178db836d0c6c))
|
|
75
|
-
* **utils:** improve `ngcc-jest-processor` util script to exclude some Jest args ([#662](https://github.com/thymikee/jest-preset-angular/issues/662)) ([cf1bb4c](https://github.com/thymikee/jest-preset-angular/commit/cf1bb4c36e1e68804658da02c6ca3a2bd783a6e2))
|
|
76
141
|
|
|
142
|
+
## BREAKING CHANGES
|
|
143
|
+
|
|
144
|
+
When generating a new project from Angular CLI, by default the `tsconfig.json` doesn't contain any path mappings hence removing `moduleNameMapper` from preset will make sure that the preset works in pair with `tsconfig.json`.
|
|
145
|
+
|
|
146
|
+
Ones who are relying on the value of `moduleNameMapper` from the preset should create their own `moduleNameMapper` config manually or via `ts-jest` util https://kulshekhar.github.io/ts-jest/docs/getting-started/paths-mapping
|
|
77
147
|
|
|
78
|
-
### Performance Improvements
|
|
79
148
|
|
|
80
|
-
|
|
81
|
-
|
|
149
|
+
|
|
150
|
+
# [9.0.0-next.13](https://github.com/thymikee/jest-preset-angular/compare/v9.0.0-next.12...v9.0.0-next.13) (2021-04-18)
|
|
82
151
|
|
|
83
152
|
|
|
84
153
|
### BREAKING CHANGES
|
|
85
154
|
|
|
86
|
-
*
|
|
87
|
-
* `jest-preset-angular` no longer ships with `es5` build but now with `es2015`
|
|
88
|
-
* Require Jest 27
|
|
155
|
+
* Drop support for Node.js version 10 since it becomes EOL on **2021-04-30**. To support Angular 12, Node.js **12.13+** or **14.15+** is required.
|
|
89
156
|
|
|
90
157
|
|
|
91
158
|
|
|
92
|
-
# [9.0.0-next.
|
|
159
|
+
# [9.0.0-next.12](https://github.com/thymikee/jest-preset-angular/compare/v9.0.0-next.11...v9.0.0-next.12) (2021-03-31)
|
|
93
160
|
|
|
94
161
|
|
|
95
162
|
### Bug Fixes
|
|
96
163
|
|
|
97
|
-
*
|
|
98
|
-
|
|
164
|
+
* define export path for `jest-preset` ([#896](https://github.com/thymikee/jest-preset-angular/issues/896)) ([218b217](https://github.com/thymikee/jest-preset-angular/commit/218b217c02d053ab98f476f26f716e95d407ac5c))
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
# [9.0.0-next.11](https://github.com/thymikee/jest-preset-angular/compare/v9.0.0-next.10...v9.0.0-next.11) (2021-03-21)
|
|
99
169
|
|
|
100
170
|
|
|
101
171
|
### Features
|
|
102
172
|
|
|
103
|
-
* **
|
|
173
|
+
* **config:** load zone ESM when running jest in ESM mode ([#892](https://github.com/thymikee/jest-preset-angular/issues/892)) ([e03ec19](https://github.com/thymikee/jest-preset-angular/commit/e03ec19c30b6ff257d0ddd7a8783d65ed5f43f8e)), closes [#751](https://github.com/thymikee/jest-preset-angular/issues/751)
|
|
104
174
|
|
|
105
175
|
|
|
176
|
+
### BREAKING CHANGES
|
|
106
177
|
|
|
178
|
+
* add `exports` field to `package.json`, see https://nodejs.org/api/packages.html#packages_package_entry_points
|
|
107
179
|
|
|
108
|
-
# [9.0.0-next.2](https://github.com/thymikee/jest-preset-angular/compare/v9.0.0-next.0...v9.0.0-next.2) (2020-11-08)
|
|
109
180
|
|
|
110
181
|
|
|
111
|
-
|
|
182
|
+
# [8.4.0](https://github.com/thymikee/jest-preset-angular/compare/v8.3.2...v8.4.0) (2021-03-04)
|
|
112
183
|
|
|
113
|
-
* **compiler:** cache module resolution with custom compiler host ([22941cc](https://github.com/thymikee/jest-preset-angular/commit/22941ccf2a1fbf8e0c9893670ce6b9056be66534))
|
|
114
|
-
* **compiler:** only include none test files when initializing `Program` ([4cc5a1a](https://github.com/thymikee/jest-preset-angular/commit/4cc5a1a7578d45801f7437f9816b11c4d92dfeca))
|
|
115
184
|
|
|
185
|
+
### Features
|
|
116
186
|
|
|
187
|
+
* add `ngcc-jest-processor` util script ([#853](https://github.com/thymikee/jest-preset-angular/issues/853)) ([e8c9689](https://github.com/thymikee/jest-preset-angular/commit/e8c9689fa792fb64634156eef00b06e3b1e604e5))
|
|
117
188
|
|
|
118
189
|
|
|
119
|
-
|
|
190
|
+
### DEPRECATIONS
|
|
191
|
+
|
|
192
|
+
* Import serializer via `'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js'` is deprecated in favor of `'jest-preset-angular/build/serializers/no-ng-attributes'`
|
|
193
|
+
* Import serializer via `'jest-preset-angular/build/AngularSnapshotSerializer.js'` is deprecated in favor of `'jest-preset-angular/build/serializers/ng-snapshot'`
|
|
194
|
+
* Import serializer via `'jest-preset-angular/build/HTMLCommentSerializer.js'` is deprecated in favor of `'jest-preset-angular/build/serializers/html-comment'`
|
|
195
|
+
* Import setup file via `import 'jest-preset-angular'` is deprecated in favor of `import 'jest-preset-angular/setup-jest'`
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
# [9.0.0-next.8](https://github.com/thymikee/jest-preset-angular/compare/v9.0.0-next.7...v9.0.0-next.8) (2021-02-12)
|
|
120
200
|
|
|
121
201
|
|
|
122
202
|
### Features
|
|
123
203
|
|
|
124
|
-
* **compiler:**
|
|
204
|
+
* **compiler:** use constructor downlevel ctor transformer for `isolatedModules: true` ([#792](https://github.com/thymikee/jest-preset-angular/issues/792)) ([00c71ce](https://github.com/thymikee/jest-preset-angular/commit/00c71ceaa06e58432d201d9d5f8deb33e8f54665))
|
|
205
|
+
* **presets:** add type definition for `presets` entry point ([#801](https://github.com/thymikee/jest-preset-angular/issues/801)) ([e4ff0c0](https://github.com/thymikee/jest-preset-angular/commit/e4ff0c0e19e5941e7e7db1da9b5c29e01d58ab58))
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
# [9.0.0-next.6](https://github.com/thymikee/jest-preset-angular/compare/v9.0.0-next.5...v9.0.0-next.6) (2021-01-14)
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
### Features
|
|
213
|
+
|
|
214
|
+
* **compiler:** support ESM for `isolatedModules: false` ([#721](https://github.com/thymikee/jest-preset-angular/issues/721)) ([a2166f8](https://github.com/thymikee/jest-preset-angular/commit/a2166f859b1c89340ee889520595d05fa3cf65dc))
|
|
215
|
+
* **compiler:** use `replace-resources` for `isolatedModules: true` ([#717](https://github.com/thymikee/jest-preset-angular/issues/717)) ([76c25d2](https://github.com/thymikee/jest-preset-angular/commit/76c25d2d8d1de0fa458b46b473c200a2d6bd542a))
|
|
216
|
+
* **presets:** add ESM preset ([#723](https://github.com/thymikee/jest-preset-angular/issues/723)) ([b0073b0](https://github.com/thymikee/jest-preset-angular/commit/b0073b0f3a7e24f06d136367a1c2e676ac76e59e))
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
# [9.0.0-next.5](https://github.com/thymikee/jest-preset-angular/compare/v9.0.0-next.4...v9.0.0-next.5) (2021-01-06)
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
### Features
|
|
224
|
+
|
|
225
|
+
* **compiler:** use `replace-resources` transformer from Angular ([#708](https://github.com/thymikee/jest-preset-angular/issues/708)) ([1b20c19](https://github.com/thymikee/jest-preset-angular/commit/1b20c196586487a119f7e5e545c2a7fcfe6359fb))
|
|
226
|
+
* **utils:** add `es2015` to `ngcc` script's properties ([#701](https://github.com/thymikee/jest-preset-angular/issues/701)) ([a13070b](https://github.com/thymikee/jest-preset-angular/commit/a13070b4174633e80d37ede754d57b3c2374803f))
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
### BREAKING CHANGES
|
|
230
|
+
|
|
231
|
+
* `isolatedModules: true` will use `inline-files` and `strip-styles` transformers as default transformers.
|
|
232
|
+
* `isolatedModules: false` will use `replace-resources` transformer from `@ngtools/webpack` (besides the existing `downlevel-ctor` transformer). This will make `jest-preset-angular` become closer to what Angular CLI does with Karma + Jasmine.
|
|
233
|
+
* For users who migrate from **v8.3.2** to **9.0.0**, any references to `'jest-preset-angular/build/InlineFilesTransformer'` and `'jest-preset-angular/build/StripStylesTransformer'` should be removed from jest config.
|
|
234
|
+
* For users who migrate from **9.0.0-next.4**, any references to `jest-preset-angular/build/transformers/inline-files` and `jest-preset-angular/build/transformers/inline-files` should be removed from jest config.
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
# [9.0.0-next.4](https://github.com/thymikee/jest-preset-angular/compare/v9.0.0-next.0...v9.0.0-next.4) (2020-12-18)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
### Performance Improvements
|
|
242
|
+
|
|
243
|
+
* **compiler:** reuse `cacheFS` from jest to reduce file system reading ([#679](https://github.com/thymikee/jest-preset-angular/issues/679)) ([f5d9d4b](https://github.com/thymikee/jest-preset-angular/commit/f5d9d4b9c0b5440ab14ddb4a636ea84d384e3408))
|
|
244
|
+
* **config:** set `skipLibCheck: true` if not defined in tsconfig ([#678](https://github.com/thymikee/jest-preset-angular/issues/678)) ([0df3ce1](https://github.com/thymikee/jest-preset-angular/commit/0df3ce159c6778893dc08e35bdb99d0f3e0285b5))
|
|
125
245
|
|
|
126
246
|
|
|
127
247
|
### BREAKING CHANGES
|
|
128
248
|
|
|
129
|
-
*
|
|
249
|
+
* 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.
|
|
250
|
+
* Require Jest 27
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
# [9.0.0-next.1](https://github.com/thymikee/jest-preset-angular/compare/v9.0.0-next.0...v9.0.0-next.1) (2020-10-29)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
### BREAKING CHANGES
|
|
258
|
+
|
|
259
|
+
* **compiler:** `jest-preset-angular` now switches to default to use its own transformer which wraps around `ts-jest` to transform codes.
|
|
130
260
|
|
|
131
261
|
Users who are currently doing in jest config
|
|
132
262
|
```
|
|
@@ -150,8 +280,6 @@ module.exports = {
|
|
|
150
280
|
}
|
|
151
281
|
```
|
|
152
282
|
|
|
153
|
-
`isolatedModule: true` will still use `ts-jest` to compile `ts` to `js` but you won't get full compatibility with Ivy.
|
|
154
|
-
|
|
155
283
|
|
|
156
284
|
|
|
157
285
|
## [8.3.2](https://github.com/thymikee/jest-preset-angular/compare/v8.3.1...v8.3.2) (2020-10-23)
|
|
@@ -178,64 +306,8 @@ We are working on Ivy compatibility for this preset. This requires introducing a
|
|
|
178
306
|
one from `ts-jest`. To get updates on this work, please subscribe to [#409](https://github.com/thymikee/jest-preset-angular/issues/409)
|
|
179
307
|
|
|
180
308
|
* Users who are using `import 'jest-preset-angular'` should change to `import 'jest-preset-angular/setup-jest'`
|
|
181
|
-
* Drop support for Angular < 8.0
|
|
182
|
-
* **transformers:**
|
|
183
|
-
```
|
|
184
|
-
// jest.config.js
|
|
185
|
-
const customTransformers = require('./build/transformers');
|
|
186
|
-
|
|
187
|
-
module.exports = {
|
|
188
|
-
// [...]
|
|
189
|
-
globals: {
|
|
190
|
-
'ts-jest': {
|
|
191
|
-
tsconfig: '<rootDir>/tsconfig.spec.json',
|
|
192
|
-
stringifyContentPathRegex: '\\.html$',
|
|
193
|
-
astTransformers: {
|
|
194
|
-
before: customTransformers,
|
|
195
|
-
},
|
|
196
|
-
},
|
|
197
|
-
},
|
|
198
|
-
}
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
One is using one of `jest-preset-angular` transformers should change jest config to have:
|
|
202
|
-
```
|
|
203
|
-
// jest.config.js
|
|
204
|
-
module.exports = {
|
|
205
|
-
// [...]
|
|
206
|
-
globals: {
|
|
207
|
-
'ts-jest': {
|
|
208
|
-
tsconfig: '<rootDir>/tsconfig.spec.json',
|
|
209
|
-
stringifyContentPathRegex: '\\.html$',
|
|
210
|
-
astTransformers: {
|
|
211
|
-
before: [
|
|
212
|
-
'jest-preset-angular/build/transformers/inline-files'
|
|
213
|
-
],
|
|
214
|
-
},
|
|
215
|
-
},
|
|
216
|
-
},
|
|
217
|
-
}
|
|
218
|
-
```
|
|
219
|
-
or
|
|
220
|
-
```
|
|
221
|
-
// package.json
|
|
222
|
-
{
|
|
223
|
-
"jest" {
|
|
224
|
-
// [...]
|
|
225
|
-
"globals": {
|
|
226
|
-
"ts-jest": {
|
|
227
|
-
"tsconfig": "<rootDir>/tsconfig.spec.json",
|
|
228
|
-
"stringifyContentPathRegex": "\\.html$",
|
|
229
|
-
"astTransformers": {
|
|
230
|
-
"before": [
|
|
231
|
-
"jest-preset-angular/build/transformers/inline-files"
|
|
232
|
-
]
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
```
|
|
309
|
+
* Drop support for Angular < **8.0**, see https://angular.io/guide/releases#support-policy-and-schedule
|
|
310
|
+
* **transformers:** The AST transformers `InlineFilesTransformer` and `StripStylesTransformer` are **REMOVED** and default `jest-preset-angular` uses AST transformers from `@angular/compiler-cli`. One should remove the old transformers from the jest config.
|
|
239
311
|
* **serializers:** One is using all `jest-preset-angular` snapshot serializers should change jest config to have:
|
|
240
312
|
```
|
|
241
313
|
// jest.config.js
|
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
|
|
|
@@ -19,13 +18,13 @@ please check [online documentation](https://thymikee.github.io/jest-preset-angul
|
|
|
19
18
|
Install using [`yarn`](https://yarnpkg.com/en/package/jest-preset-angular):
|
|
20
19
|
|
|
21
20
|
```bash
|
|
22
|
-
yarn add -D jest jest-preset-angular
|
|
21
|
+
yarn add -D jest jest-preset-angular @types/jest
|
|
23
22
|
```
|
|
24
23
|
|
|
25
24
|
Or [`npm`](https://www.npmjs.com/package/jest-preset-angular):
|
|
26
25
|
|
|
27
26
|
```bash
|
|
28
|
-
npm install -D jest jest-preset-angular
|
|
27
|
+
npm install -D jest jest-preset-angular @types/jest
|
|
29
28
|
```
|
|
30
29
|
|
|
31
30
|
## Configuration
|
|
@@ -33,7 +32,7 @@ npm install -D jest jest-preset-angular
|
|
|
33
32
|
In your project root, create `setup-jest.ts` file with following contents:
|
|
34
33
|
|
|
35
34
|
```ts
|
|
36
|
-
import 'jest-preset-angular';
|
|
35
|
+
import 'jest-preset-angular/setup-jest';
|
|
37
36
|
```
|
|
38
37
|
|
|
39
38
|
Add the following section:
|
|
@@ -59,11 +58,32 @@ module.exports = {
|
|
|
59
58
|
}
|
|
60
59
|
```
|
|
61
60
|
|
|
61
|
+
Adjust your `tsconfig.spec.json` to be:
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"extends": "./tsconfig.json",
|
|
66
|
+
"compilerOptions": {
|
|
67
|
+
"outDir": "./out-tsc/spec",
|
|
68
|
+
"types": ["jest"]
|
|
69
|
+
},
|
|
70
|
+
"include": ["src/**/*.spec.ts", "src/**/*.d.ts"]
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Angular Ivy
|
|
75
|
+
|
|
76
|
+
Check out our [Angular Ivy guidance](https://thymikee.github.io/jest-preset-angular/docs/guides/angular-ivy)
|
|
77
|
+
|
|
78
|
+
## Example apps
|
|
79
|
+
|
|
80
|
+
We have [example apps](https://github.com/thymikee/jest-preset-angular/tree/master/examples) to provide a basic setup to use Jest in an Angular project.
|
|
81
|
+
|
|
62
82
|
## Built With
|
|
63
83
|
|
|
64
84
|
- [TypeScript](https://www.typescriptlang.org/) - JavaScript that scales
|
|
65
85
|
- [Angular](https://angular.io/) - The modern web developer's platform
|
|
66
|
-
- [`ts-jest`](https://kulshekhar.github.io/ts-jest) - Jest
|
|
86
|
+
- [`ts-jest`](https://kulshekhar.github.io/ts-jest) - Jest transformer for TypeScript
|
|
67
87
|
|
|
68
88
|
## Authors/maintainers
|
|
69
89
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
require('../utils/reflect-metadata');
|
|
3
3
|
try {
|
|
4
|
-
|
|
4
|
+
!process.execArgv.includes('--experimental-vm-modules')
|
|
5
|
+
? require('zone.js/bundles/zone-testing-bundle.umd.js')
|
|
6
|
+
: require('zone.js/fesm2015/zone-testing-bundle.min.js');
|
|
5
7
|
}
|
|
6
8
|
catch (err) {
|
|
7
9
|
require('zone.js/dist/zone');
|
package/build/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createTransformer = void 0;
|
|
4
3
|
const ng_jest_transformer_1 = require("./ng-jest-transformer");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
exports.createTransformer = createTransformer;
|
|
4
|
+
exports.default = {
|
|
5
|
+
createTransformer: () => new ng_jest_transformer_1.NgJestTransformer(),
|
|
6
|
+
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.replaceResources = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const typescript_1 = tslib_1.__importDefault(require("typescript"));
|
|
6
6
|
const constants_1 = require("../constants");
|
|
7
|
+
const useNodeFactory = +typescript_1.default.versionMajorMinor >= 4.0;
|
|
7
8
|
const shouldTransform = (fileName) => !fileName.endsWith('.ngfactory.ts') && !fileName.endsWith('.ngstyle.ts');
|
|
8
9
|
function replaceResources({ program }) {
|
|
9
10
|
return (context) => {
|
|
@@ -12,8 +13,12 @@ function replaceResources({ program }) {
|
|
|
12
13
|
const moduleKind = context.getCompilerOptions().module;
|
|
13
14
|
const visitNode = (node) => {
|
|
14
15
|
if (typescript_1.default.isClassDeclaration(node)) {
|
|
15
|
-
const decorators = typescript_1.default.visitNodes(node.decorators, (node) => typescript_1.default.isDecorator(node)
|
|
16
|
-
|
|
16
|
+
const decorators = typescript_1.default.visitNodes(node.decorators, (node) => typescript_1.default.isDecorator(node)
|
|
17
|
+
? visitDecorator(context.factory, node, typeChecker, resourceImportDeclarations, moduleKind)
|
|
18
|
+
: node);
|
|
19
|
+
return useNodeFactory
|
|
20
|
+
? context.factory.updateClassDeclaration(node, decorators, node.modifiers, node.name, node.typeParameters, node.heritageClauses, node.members)
|
|
21
|
+
: typescript_1.default.updateClassDeclaration(node, decorators, node.modifiers, node.name, node.typeParameters, node.heritageClauses, node.members);
|
|
17
22
|
}
|
|
18
23
|
return typescript_1.default.visitEachChild(node, visitNode, context);
|
|
19
24
|
};
|
|
@@ -23,14 +28,16 @@ function replaceResources({ program }) {
|
|
|
23
28
|
}
|
|
24
29
|
const updatedSourceFile = typescript_1.default.visitNode(sourceFile, visitNode);
|
|
25
30
|
if (resourceImportDeclarations.length) {
|
|
26
|
-
return
|
|
31
|
+
return useNodeFactory
|
|
32
|
+
? context.factory.updateSourceFile(updatedSourceFile, typescript_1.default.setTextRange(context.factory.createNodeArray([...resourceImportDeclarations, ...updatedSourceFile.statements]), updatedSourceFile.statements))
|
|
33
|
+
: typescript_1.default.updateSourceFileNode(updatedSourceFile, typescript_1.default.setTextRange(typescript_1.default.createNodeArray([...resourceImportDeclarations, ...updatedSourceFile.statements]), updatedSourceFile.statements));
|
|
27
34
|
}
|
|
28
35
|
return updatedSourceFile;
|
|
29
36
|
};
|
|
30
37
|
};
|
|
31
38
|
}
|
|
32
39
|
exports.replaceResources = replaceResources;
|
|
33
|
-
function visitDecorator(node, typeChecker, resourceImportDeclarations, moduleKind) {
|
|
40
|
+
function visitDecorator(nodeFactory, node, typeChecker, resourceImportDeclarations, moduleKind) {
|
|
34
41
|
if (!isComponentDecorator(node, typeChecker)) {
|
|
35
42
|
return node;
|
|
36
43
|
}
|
|
@@ -43,14 +50,25 @@ function visitDecorator(node, typeChecker, resourceImportDeclarations, moduleKin
|
|
|
43
50
|
return node;
|
|
44
51
|
}
|
|
45
52
|
const objectExpression = args[0];
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
const styleReplacements = [];
|
|
54
|
+
let properties = typescript_1.default.visitNodes(objectExpression.properties, (node) => typescript_1.default.isObjectLiteralElementLike(node)
|
|
55
|
+
? visitComponentMetadata(nodeFactory, node, resourceImportDeclarations, moduleKind)
|
|
56
|
+
: node);
|
|
57
|
+
if (styleReplacements.length) {
|
|
58
|
+
const styleProperty = useNodeFactory
|
|
59
|
+
? nodeFactory.createPropertyAssignment(nodeFactory.createIdentifier(constants_1.STYLES), nodeFactory.createArrayLiteralExpression(styleReplacements))
|
|
60
|
+
: typescript_1.default.createPropertyAssignment(typescript_1.default.createIdentifier(constants_1.STYLES), typescript_1.default.createArrayLiteral(styleReplacements));
|
|
61
|
+
properties = useNodeFactory
|
|
62
|
+
? nodeFactory.createNodeArray([...properties, styleProperty])
|
|
63
|
+
: typescript_1.default.createNodeArray([...properties, styleProperty]);
|
|
64
|
+
}
|
|
65
|
+
return useNodeFactory
|
|
66
|
+
? nodeFactory.updateDecorator(node, nodeFactory.updateCallExpression(decoratorFactory, decoratorFactory.expression, decoratorFactory.typeArguments, [nodeFactory.updateObjectLiteralExpression(objectExpression, properties)]))
|
|
67
|
+
: typescript_1.default.updateDecorator(node, typescript_1.default.updateCall(decoratorFactory, decoratorFactory.expression, decoratorFactory.typeArguments, [
|
|
68
|
+
typescript_1.default.updateObjectLiteral(objectExpression, properties),
|
|
69
|
+
]));
|
|
52
70
|
}
|
|
53
|
-
function visitComponentMetadata(node, resourceImportDeclarations, moduleKind) {
|
|
71
|
+
function visitComponentMetadata(nodeFactory, node, resourceImportDeclarations, moduleKind) {
|
|
54
72
|
if (!typescript_1.default.isPropertyAssignment(node) || typescript_1.default.isComputedPropertyName(node.name)) {
|
|
55
73
|
return node;
|
|
56
74
|
}
|
|
@@ -59,11 +77,17 @@ function visitComponentMetadata(node, resourceImportDeclarations, moduleKind) {
|
|
|
59
77
|
case 'moduleId':
|
|
60
78
|
return undefined;
|
|
61
79
|
case constants_1.TEMPLATE_URL:
|
|
62
|
-
const
|
|
80
|
+
const url = getResourceUrl(node.initializer);
|
|
81
|
+
if (!url) {
|
|
82
|
+
return node;
|
|
83
|
+
}
|
|
84
|
+
const importName = createResourceImport(nodeFactory, url, resourceImportDeclarations, moduleKind);
|
|
63
85
|
if (!importName) {
|
|
64
86
|
return node;
|
|
65
87
|
}
|
|
66
|
-
return
|
|
88
|
+
return useNodeFactory
|
|
89
|
+
? nodeFactory.updatePropertyAssignment(node, nodeFactory.createIdentifier(constants_1.TEMPLATE), importName)
|
|
90
|
+
: typescript_1.default.updatePropertyAssignment(node, typescript_1.default.createIdentifier(constants_1.TEMPLATE), importName);
|
|
67
91
|
case constants_1.STYLES:
|
|
68
92
|
case constants_1.STYLE_URLS:
|
|
69
93
|
if (!typescript_1.default.isArrayLiteralExpression(node.initializer)) {
|
|
@@ -80,7 +104,6 @@ function getResourceUrl(node) {
|
|
|
80
104
|
}
|
|
81
105
|
return `${/^\.?\.\//.test(node.text) ? '' : './'}${node.text}`;
|
|
82
106
|
}
|
|
83
|
-
exports.getResourceUrl = getResourceUrl;
|
|
84
107
|
function isComponentDecorator(node, typeChecker) {
|
|
85
108
|
if (!typescript_1.default.isDecorator(node)) {
|
|
86
109
|
return false;
|
|
@@ -88,18 +111,19 @@ function isComponentDecorator(node, typeChecker) {
|
|
|
88
111
|
const origin = getDecoratorOrigin(node, typeChecker);
|
|
89
112
|
return !!(origin && origin.module === '@angular/core' && origin.name === constants_1.COMPONENT);
|
|
90
113
|
}
|
|
91
|
-
function createResourceImport(
|
|
92
|
-
const
|
|
93
|
-
if (!url) {
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
const urlLiteral = typescript_1.default.createLiteral(url);
|
|
114
|
+
function createResourceImport(nodeFactory, url, resourceImportDeclarations, moduleKind = typescript_1.default.ModuleKind.ES2015) {
|
|
115
|
+
const urlLiteral = useNodeFactory ? nodeFactory.createStringLiteral(url) : typescript_1.default.createLiteral(url);
|
|
97
116
|
if (moduleKind < typescript_1.default.ModuleKind.ES2015) {
|
|
98
|
-
return
|
|
117
|
+
return useNodeFactory
|
|
118
|
+
? nodeFactory.createCallExpression(nodeFactory.createIdentifier(constants_1.REQUIRE), [], [urlLiteral])
|
|
119
|
+
: typescript_1.default.createCall(typescript_1.default.createIdentifier(constants_1.REQUIRE), undefined, [urlLiteral]);
|
|
99
120
|
}
|
|
100
121
|
else {
|
|
101
122
|
const importName = typescript_1.default.createIdentifier(`__NG_CLI_RESOURCE__${resourceImportDeclarations.length}`);
|
|
102
|
-
|
|
123
|
+
const importDeclaration = useNodeFactory
|
|
124
|
+
? nodeFactory.createImportDeclaration(undefined, undefined, nodeFactory.createImportClause(false, importName, undefined), urlLiteral)
|
|
125
|
+
: typescript_1.default.createImportDeclaration(undefined, undefined, typescript_1.default.createImportClause(importName, undefined), urlLiteral);
|
|
126
|
+
resourceImportDeclarations.push(importDeclaration);
|
|
103
127
|
return importName;
|
|
104
128
|
}
|
|
105
129
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jest-preset-angular",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.3",
|
|
4
4
|
"description": "Jest preset configuration for Angular projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "build/index.js",
|
|
@@ -24,77 +24,76 @@
|
|
|
24
24
|
"testing"
|
|
25
25
|
],
|
|
26
26
|
"scripts": {
|
|
27
|
-
"prebuild": "node scripts/clean.js",
|
|
28
27
|
"prepare": "yarn build",
|
|
28
|
+
"prebuild": "node scripts/clean.js",
|
|
29
29
|
"build": "tsc -p tsconfig.build.json",
|
|
30
30
|
"lint": "eslint --ext .js,.ts .",
|
|
31
31
|
"lint:fix": "eslint --fix --ext .js,.ts .",
|
|
32
|
-
"lint:prettier": "prettier '**/*.{yml,yaml}' 'website/**/*.{css,js,md}' 'README.md'",
|
|
33
|
-
"lint:prettier-
|
|
34
|
-
"
|
|
35
|
-
"test:
|
|
36
|
-
"test-cjs:unit": "jest -i",
|
|
37
|
-
"test-esm:unit": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js -i -c=jest-esm.config.js",
|
|
38
|
-
"test:e2e": "node scripts/e2e.js",
|
|
32
|
+
"lint:prettier": "prettier '**/*.{yml,yaml}' 'website/**/*.{css,js,md}' 'README.md' --write --ignore-path .gitignore",
|
|
33
|
+
"lint:prettier-ci": "prettier '**/*.{yml,yaml}' 'website/**/*.{css,js,md}' 'README.md' --check --ignore-path .gitignore",
|
|
34
|
+
"test": "jest",
|
|
35
|
+
"test:examples": "node scripts/test-examples.js",
|
|
39
36
|
"doc": "cd website && yarn start",
|
|
40
37
|
"doc:build": "cd website && yarn build",
|
|
41
38
|
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1",
|
|
42
|
-
"_postinstall": "husky install",
|
|
43
39
|
"prepublishOnly": "pinst --disable",
|
|
44
|
-
"postpublish": "pinst --enable"
|
|
40
|
+
"postpublish": "pinst --enable",
|
|
41
|
+
"update-examples": "node scripts/upgrade-examples-deps.js"
|
|
45
42
|
},
|
|
46
43
|
"dependencies": {
|
|
47
|
-
"jest-environment-jsdom": "27.0.0
|
|
48
|
-
"pretty-format": "27.0.0
|
|
49
|
-
"ts-jest": "27.0.0
|
|
44
|
+
"jest-environment-jsdom": "^27.0.0",
|
|
45
|
+
"pretty-format": "^27.0.0",
|
|
46
|
+
"ts-jest": "^27.0.0"
|
|
50
47
|
},
|
|
51
48
|
"peerDependencies": {
|
|
52
49
|
"@angular-devkit/build-angular": ">=0.901.12",
|
|
50
|
+
"@angular/platform-browser-dynamic": ">=9.0.0",
|
|
53
51
|
"@angular/core": ">=9.0.0",
|
|
54
|
-
"jest": "27.0.0
|
|
52
|
+
"jest": "^27.0.0"
|
|
55
53
|
},
|
|
56
54
|
"optionalDependencies": {
|
|
57
|
-
"webpack": "5.
|
|
55
|
+
"webpack": "5.36.2"
|
|
58
56
|
},
|
|
59
57
|
"devDependencies": {
|
|
60
|
-
"@angular-devkit/build-angular": "^0.1102.
|
|
61
|
-
"@angular
|
|
62
|
-
"@angular
|
|
63
|
-
"@angular
|
|
64
|
-
"@angular/
|
|
65
|
-
"@angular/
|
|
66
|
-
"@angular/
|
|
67
|
-
"@angular/
|
|
68
|
-
"@
|
|
69
|
-
"@
|
|
70
|
-
"@
|
|
71
|
-
"@
|
|
72
|
-
"@jest/
|
|
73
|
-
"@jest
|
|
74
|
-
"@
|
|
75
|
-
"@types/
|
|
76
|
-
"@
|
|
77
|
-
"@typescript-eslint/
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"eslint": "
|
|
81
|
-
"eslint-
|
|
82
|
-
"eslint-plugin-
|
|
83
|
-
"eslint-plugin-
|
|
84
|
-
"eslint-plugin-
|
|
85
|
-
"eslint-plugin-
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"glob": "
|
|
89
|
-
"husky": "
|
|
90
|
-
"jest": "^27.0.
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
58
|
+
"@angular-devkit/build-angular": "^0.1102.11",
|
|
59
|
+
"@angular/animations": "^11.2.12",
|
|
60
|
+
"@angular/common": "^11.2.12",
|
|
61
|
+
"@angular/compiler": "^11.2.12",
|
|
62
|
+
"@angular/compiler-cli": "^11.2.12",
|
|
63
|
+
"@angular/core": "^11.2.12",
|
|
64
|
+
"@angular/platform-browser": "^11.2.12",
|
|
65
|
+
"@angular/platform-browser-dynamic": "^11.2.12",
|
|
66
|
+
"@commitlint/cli": "^12.1.1",
|
|
67
|
+
"@commitlint/config-angular": "^12.1.1",
|
|
68
|
+
"@jest/globals": "^27.0.1",
|
|
69
|
+
"@jest/transform": "^27.0.1",
|
|
70
|
+
"@jest/types": "^27.0.1",
|
|
71
|
+
"@types/jest": "^26.0.23",
|
|
72
|
+
"@types/node": "^14.14.44",
|
|
73
|
+
"@types/semver": "^7.3.5",
|
|
74
|
+
"@typescript-eslint/eslint-plugin": "^4.22.1",
|
|
75
|
+
"@typescript-eslint/parser": "^4.22.1",
|
|
76
|
+
"conventional-changelog-cli": "^2.1.1",
|
|
77
|
+
"eslint": "^7.25.0",
|
|
78
|
+
"eslint-config-prettier": "^8.3.0",
|
|
79
|
+
"eslint-plugin-import": "^2.22.1",
|
|
80
|
+
"eslint-plugin-jest": "^24.3.6",
|
|
81
|
+
"eslint-plugin-jsdoc": "^33.1.0",
|
|
82
|
+
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
83
|
+
"eslint-plugin-prettier": "^3.4.0",
|
|
84
|
+
"execa": "^5.0.0",
|
|
85
|
+
"glob": "^7.1.6",
|
|
86
|
+
"glob-gitignore": "^1.0.14",
|
|
87
|
+
"husky": "^6.0.0",
|
|
88
|
+
"jest": "^27.0.1",
|
|
89
|
+
"jest-snapshot-serializer-raw": "^1.2.0",
|
|
90
|
+
"lint-staged": "^10.5.4",
|
|
91
|
+
"pinst": "^2.1.6",
|
|
92
|
+
"prettier": "^2.2.1",
|
|
93
|
+
"rxjs": "^6.6.7",
|
|
94
|
+
"tslib": "^2.2.0",
|
|
95
|
+
"typescript": "~4.1.5",
|
|
96
|
+
"zone.js": "^0.11.4"
|
|
98
97
|
},
|
|
99
98
|
"lint-staged": {
|
|
100
99
|
"*.{ts,js}": [
|
|
@@ -103,6 +102,6 @@
|
|
|
103
102
|
]
|
|
104
103
|
},
|
|
105
104
|
"engines": {
|
|
106
|
-
"node": ">=
|
|
105
|
+
"node": "^12.13.0 || ^14.15.0 || >=15.0.0"
|
|
107
106
|
}
|
|
108
107
|
}
|
package/presets/index.js
CHANGED
|
@@ -12,14 +12,8 @@ const basePreset = {
|
|
|
12
12
|
'^.+\\.(ts|js|html)$': 'jest-preset-angular',
|
|
13
13
|
},
|
|
14
14
|
moduleFileExtensions: ['ts', 'html', 'js', 'json'],
|
|
15
|
-
moduleNameMapper: {
|
|
16
|
-
'^src/(.*)$': '<rootDir>/src/$1',
|
|
17
|
-
'^app/(.*)$': '<rootDir>/src/app/$1',
|
|
18
|
-
'^assets/(.*)$': '<rootDir>/src/assets/$1',
|
|
19
|
-
'^environments/(.*)$': '<rootDir>/src/environments/$1',
|
|
20
|
-
},
|
|
21
15
|
snapshotSerializers,
|
|
22
|
-
}
|
|
16
|
+
};
|
|
23
17
|
|
|
24
18
|
module.exports = {
|
|
25
19
|
defaults: basePreset,
|
|
@@ -33,11 +27,8 @@ module.exports = {
|
|
|
33
27
|
},
|
|
34
28
|
},
|
|
35
29
|
moduleNameMapper: {
|
|
36
|
-
|
|
37
|
-
'tslib': '<rootDir>/node_modules/tslib/tslib.es6.js',
|
|
30
|
+
tslib: 'tslib/tslib.es6.js',
|
|
38
31
|
},
|
|
39
|
-
transformIgnorePatterns: [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
}
|
|
32
|
+
transformIgnorePatterns: ['node_modules/(?!tslib)'],
|
|
33
|
+
},
|
|
34
|
+
};
|