12
12
13
13
> This is a part of the article: [ Testing Angular faster with Jest] ( https://www.xfive.co/blog/testing-angular-faster-jest/ ) .
14
14
15
- ## Getting Started
16
-
17
- These instructions will get you setup to use ` jest-preset-angular ` in your project. For more detailed documentation,
18
- please check [ online documentation] ( https://thymikee.github.io/jest-preset-angular ) .
15
+ ## Installation
19
16
20
17
Install using [ ` yarn ` ] ( https://yarnpkg.com/en/package/jest-preset-angular ) :
21
18
@@ -31,54 +28,7 @@ npm install -D jest jest-preset-angular @types/jest
31
28
32
29
## Configuration
33
30
34
- In your project root, create ` setup-jest.ts ` file with following contents:
35
-
36
- ``` ts
37
- // setup-jest.ts
38
- import { setupZoneTestEnv } from ' jest-preset-angular/setup-env/zone' ;
39
-
40
- setupZoneTestEnv ();
41
- ```
42
-
43
- Add the following section:
44
-
45
- - to your root ` jest.config.ts `
46
-
47
- ``` ts
48
- // jest.config.ts
49
- import type { Config } from ' jest' ;
50
-
51
- const jestConfig: Config = {
52
- preset: ' jest-preset-angular' ,
53
- setupFilesAfterEnv: [' <rootDir>/setup-jest.ts' ],
54
- };
55
-
56
- export default jestConfig ;
57
- ```
58
-
59
- - or to your root ` package.json `
60
-
61
- ``` json
62
- {
63
- "jest" : {
64
- "preset" : " jest-preset-angular" ,
65
- "setupFilesAfterEnv" : [" <rootDir>/setup-jest.ts" ]
66
- }
67
- }
68
- ```
69
-
70
- Adjust your ` tsconfig.spec.json ` to be:
71
-
72
- ``` json
73
- {
74
- "extends" : " ./tsconfig.json" ,
75
- "compilerOptions" : {
76
- "module" : " CommonJS" ,
77
- "types" : [" jest" ]
78
- },
79
- "include" : [" src/**/*.spec.ts" , " src/**/*.d.ts" ]
80
- }
81
- ```
31
+ Check out our [ Configuration guidance] ( https://thymikee.github.io/jest-preset-angular/docs/getting-started/installation ) .
82
32
83
33
** IMPORTANT**
84
34
0 commit comments