jest-preset-angular 5.2.3 → 6.0.2
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 +17 -0
- package/README.md +34 -0
- package/package.json +7 -7
- package/preprocessor.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
## Changelog (master)
|
|
2
2
|
|
|
3
|
+
### v6.0.1
|
|
4
|
+
|
|
5
|
+
* Fix: Support backtick quoted templateUrl. ([#182](https://github.com/thymikee/jest-preset-angular/pull/182))
|
|
6
|
+
* Fix: Restrict version of ts-jest to ~23.1.3 ([#196](https://github.com/thymikee/jest-preset-angular/pull/196))
|
|
7
|
+
* Chore: Add HeroesComponent example with mocked service provider ([#110](https://github.com/thymikee/jest-preset-angular/pull/110))
|
|
8
|
+
* Chore: Adjust troubleshooting to support configuration with Angular 6 ([#187](https://github.com/thymikee/jest-preset-angular/pull/187))
|
|
9
|
+
* Chore: Update dependencies for example app ([#179](https://github.com/thymikee/jest-preset-angular/pull/179))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### v6.0.0
|
|
13
|
+
|
|
14
|
+
* Chore: Upgrade `ts-jest`, `@types/jest` in dependencies to be compatible with `jest` v23. ([#173](https://github.com/thymikee/jest-preset-angular/pull/173))
|
|
15
|
+
* Chore: Upgrade peer dependency `jest` to be compatible with `jest` v23. ([#173](https://github.com/thymikee/jest-preset-angular/pull/173))
|
|
16
|
+
|
|
17
|
+
### v5.2.3
|
|
18
|
+
|
|
3
19
|
* Chore: Upgrade example app to Angular 6 ([#150](https://github.com/thymikee/jest-preset-angular/pull/150))
|
|
4
20
|
* Chore: Upgrade dependencies for the repository ([#150](https://github.com/thymikee/jest-preset-angular/pull/150))
|
|
21
|
+
* Fix: fix `preprocess.js` to not break on spaces before colon ([#165](https://github.com/thymikee/jest-preset-angular/pull/165))
|
|
5
22
|
|
|
6
23
|
### v5.2.2
|
|
7
24
|
|
package/README.md
CHANGED
|
@@ -299,6 +299,40 @@ If you choose to overide `globals` in order to point at a specific tsconfig, you
|
|
|
299
299
|
|
|
300
300
|
This means, that a file is not transformed through TypeScript compiler, e.g. because it is a JS file with TS syntax, or it is published to npm as uncompiled source files. Here's what you can do.
|
|
301
301
|
|
|
302
|
+
#### Adjust your `tsconfig.spec.json`:
|
|
303
|
+
Since Angular released v6, the default `tsconfig.json` and `tsconfig.spec.json` have been changed. Therefore, `jest` will throw an error
|
|
304
|
+
```
|
|
305
|
+
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import 'jest-preset-angular';
|
|
306
|
+
^^^^^^
|
|
307
|
+
SyntaxError: Unexpected token import
|
|
308
|
+
at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:403:17)
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
What you need to do is adjust your `tsconfig.spec.json` to add the option `"module": "commonjs",`
|
|
312
|
+
|
|
313
|
+
A default `tsconfig.spec.json` after modifying will look like this
|
|
314
|
+
```
|
|
315
|
+
{
|
|
316
|
+
"extends": "../tsconfig.json",
|
|
317
|
+
"compilerOptions": {
|
|
318
|
+
"outDir": "../out-tsc/spec",
|
|
319
|
+
"module": "commonjs",
|
|
320
|
+
"types": [
|
|
321
|
+
"jest",
|
|
322
|
+
"jquery",
|
|
323
|
+
"jsdom",
|
|
324
|
+
"node"
|
|
325
|
+
]
|
|
326
|
+
},
|
|
327
|
+
"files": [
|
|
328
|
+
"polyfills.ts"
|
|
329
|
+
],
|
|
330
|
+
"include": [
|
|
331
|
+
"**/*.spec.ts",
|
|
332
|
+
"**/*.d.ts"
|
|
333
|
+
]
|
|
334
|
+
```
|
|
335
|
+
|
|
302
336
|
#### Adjust your `transformIgnorePatterns` whitelist:
|
|
303
337
|
|
|
304
338
|
```json
|
package/package.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jest-preset-angular",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.2",
|
|
4
4
|
"description": "Jest preset configuration for Angular projects",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": "git@github.com:thymikee/jest-preset-angular.git",
|
|
7
7
|
"author": "Michał Pierzchała <thymikee@gmail.com>",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@types/jest": "^
|
|
11
|
-
"jest-zone-patch": "
|
|
12
|
-
"ts-jest": "
|
|
10
|
+
"@types/jest": "^23.3.1",
|
|
11
|
+
"jest-zone-patch": ">=0.0.9 <1.0.0",
|
|
12
|
+
"ts-jest": "~23.1.3"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"jest": "^
|
|
16
|
-
"typescript": "~2.
|
|
15
|
+
"jest": "^23.5.0",
|
|
16
|
+
"typescript": "~2.9.2"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"@angular/core": ">=2.0.0",
|
|
20
20
|
"@angular/platform-browser-dynamic": ">=2.0.0",
|
|
21
|
-
"jest": "^
|
|
21
|
+
"jest": "^23.0.0"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"test": "jest",
|
package/preprocessor.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const process = require('ts-jest
|
|
2
|
-
const TEMPLATE_URL_REGEX = /templateUrl\s*:\s*('|")(\.\/){0,}(.*)('|")/g;
|
|
1
|
+
const process = require('ts-jest').process;
|
|
2
|
+
const TEMPLATE_URL_REGEX = /templateUrl\s*:\s*('|"|`)(\.\/){0,}(.*)('|"|`)/g;
|
|
3
3
|
const STYLE_URLS_REGEX = /styleUrls\s*:\s*\[[^\]]*\]/g;
|
|
4
4
|
const ESCAPE_TEMPLATE_REGEX = /(\${|\`)/g;
|
|
5
5
|
|