Skip to content

Commit 24711ca

Browse files
timdeschryverbrandonroberts
authored andcommitted
chore(example): update jest dependencies and configuration (ngrx#1680)
Closes ngrx#1674
1 parent 7f42917 commit 24711ca

File tree

12 files changed

+1433
-724
lines changed

12 files changed

+1433
-724
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797
- checkout
9898
- restore_cache:
9999
key: *cache_key
100-
- run: yarn run example:test --watch=false
100+
- run: yarn run example:test --watch=false --runInBand
101101

102102
example-e2e-tests:
103103
<<: *run_in_browser

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
"@types/globby": "^8.0.0",
112112
"@types/jasmine": "2.5.45",
113113
"@types/jasminewd2": "^2.0.2",
114-
"@types/jest": "^20.0.2",
114+
"@types/jest": "^24.0.11",
115115
"@types/lodash": "^4.14.80",
116116
"@types/ncp": "^2.0.1",
117117
"@types/node": "^7.0.5",
@@ -134,9 +134,9 @@
134134
"jasmine-core": "~2.5.2",
135135
"jasmine-marbles": "^0.4.0",
136136
"jasmine-spec-reporter": "~3.2.0",
137-
"jest": "^21.0.2",
138-
"jest-preset-angular": "^3.0.1",
139-
"jest-zone-patch": "^0.0.7",
137+
"jest": "^24.5.0",
138+
"jest-preset-angular": "^7.0.1",
139+
"jest-zone-patch": "^0.0.10",
140140
"karma": "~1.4.1",
141141
"karma-chrome-launcher": "~2.0.0",
142142
"karma-cli": "~1.0.1",
Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
11
module.exports = {
22
rootDir: '.',
3-
setupTestFrameworkScriptFile: '<rootDir>/src/setup-jest.ts',
3+
setupFilesAfterEnv: ['<rootDir>/src/setup-jest.ts'],
44
globals: {
55
'ts-jest': {
6-
tsConfigFile: 'projects/example-app/tsconfig.spec.json',
6+
tsConfig: 'projects/example-app/tsconfig.spec.json',
7+
stringifyContentPathRegex: '\\.html?$',
8+
astTransformers: [
9+
require.resolve('jest-preset-angular/InlineHtmlStripStylesTransformer'),
10+
],
711
},
8-
__TRANSFORM_HTML__: true,
912
},
1013
transform: {
11-
'^.+\\.(ts|js|html)$':
12-
'<rootDir>/../../node_modules/jest-preset-angular/preprocessor.js',
14+
'^.+\\.(ts|js|html)$': 'ts-jest',
1315
},
1416
testMatch: ['<rootDir>/**/*.spec.ts'],
15-
moduleFileExtensions: ['ts', 'js', 'html', 'json'],
16-
mapCoverage: true,
17+
testEnvironment: 'jest-environment-jsdom-thirteen',
18+
moduleFileExtensions: ['html', 'js', 'json', 'ts'],
1719
coveragePathIgnorePatterns: ['/node_modules/', '/modules/*.*/'],
1820
moduleNameMapper: {
1921
'^@ngrx/(.*)': '<rootDir>/../../modules/$1',
2022
'^@example-app/(.*)': '<rootDir>/src/app/$1',
2123
},
2224
transformIgnorePatterns: ['node_modules/(?!@ngrx)'],
2325
modulePathIgnorePatterns: ['dist'],
26+
preset: 'jest-preset-angular',
27+
snapshotSerializers: [
28+
'jest-preset-angular/AngularSnapshotSerializer.js',
29+
'jest-preset-angular/HTMLCommentSerializer.js',
30+
],
2431
};

projects/example-app/src/app/auth/components/__snapshots__/login-form.component.spec.ts.snap

Lines changed: 21 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,19 @@ exports[`Login Page should compile 1`] = `
55
form={[Function FormGroup]}
66
submitted={[Function EventEmitter]}
77
>
8-
<mat-card
9-
_ngcontent-c0=""
10-
>
11-
<mat-card-title
12-
_ngcontent-c0=""
13-
>
8+
<mat-card>
9+
<mat-card-title>
1410
Login
1511
</mat-card-title>
16-
<mat-card-content
17-
_ngcontent-c0=""
18-
>
12+
<mat-card-content>
1913
<form
20-
_ngcontent-c0=""
2114
class="ng-untouched ng-pristine ng-valid"
2215
ng-reflect-form="[object Object]"
2316
novalidate=""
2417
>
25-
<p
26-
_ngcontent-c0=""
27-
>
28-
<mat-form-field
29-
_ngcontent-c0=""
30-
>
18+
<p>
19+
<mat-form-field>
3120
<input
32-
_ngcontent-c0=""
3321
class="ng-untouched ng-pristine ng-valid"
3422
formcontrolname="username"
3523
matinput=""
@@ -39,14 +27,9 @@ exports[`Login Page should compile 1`] = `
3927
/>
4028
</mat-form-field>
4129
</p>
42-
<p
43-
_ngcontent-c0=""
44-
>
45-
<mat-form-field
46-
_ngcontent-c0=""
47-
>
30+
<p>
31+
<mat-form-field>
4832
<input
49-
_ngcontent-c0=""
5033
class="ng-untouched ng-pristine ng-valid"
5134
formcontrolname="password"
5235
matinput=""
@@ -58,11 +41,9 @@ exports[`Login Page should compile 1`] = `
5841
</p>
5942
6043
<p
61-
_ngcontent-c0=""
6244
class="loginButtons"
6345
>
6446
<button
65-
_ngcontent-c0=""
6647
mat-button=""
6748
type="submit"
6849
>
@@ -80,31 +61,19 @@ exports[`Login Page should disable the form if pending 1`] = `
8061
form={[Function FormGroup]}
8162
submitted={[Function EventEmitter]}
8263
>
83-
<mat-card
84-
_ngcontent-c1=""
85-
>
86-
<mat-card-title
87-
_ngcontent-c1=""
88-
>
64+
<mat-card>
65+
<mat-card-title>
8966
Login
9067
</mat-card-title>
91-
<mat-card-content
92-
_ngcontent-c1=""
93-
>
68+
<mat-card-content>
9469
<form
95-
_ngcontent-c1=""
9670
class="ng-untouched ng-pristine"
9771
ng-reflect-form="[object Object]"
9872
novalidate=""
9973
>
100-
<p
101-
_ngcontent-c1=""
102-
>
103-
<mat-form-field
104-
_ngcontent-c1=""
105-
>
74+
<p>
75+
<mat-form-field>
10676
<input
107-
_ngcontent-c1=""
10877
class="ng-untouched ng-pristine"
10978
disabled=""
11079
formcontrolname="username"
@@ -115,14 +84,9 @@ exports[`Login Page should disable the form if pending 1`] = `
11584
/>
11685
</mat-form-field>
11786
</p>
118-
<p
119-
_ngcontent-c1=""
120-
>
121-
<mat-form-field
122-
_ngcontent-c1=""
123-
>
87+
<p>
88+
<mat-form-field>
12489
<input
125-
_ngcontent-c1=""
12690
class="ng-untouched ng-pristine"
12791
disabled=""
12892
formcontrolname="password"
@@ -135,11 +99,9 @@ exports[`Login Page should disable the form if pending 1`] = `
13599
</p>
136100
137101
<p
138-
_ngcontent-c1=""
139102
class="loginButtons"
140103
>
141104
<button
142-
_ngcontent-c1=""
143105
mat-button=""
144106
type="submit"
145107
>
@@ -158,31 +120,19 @@ exports[`Login Page should display an error message if provided 1`] = `
158120
form={[Function FormGroup]}
159121
submitted={[Function EventEmitter]}
160122
>
161-
<mat-card
162-
_ngcontent-c2=""
163-
>
164-
<mat-card-title
165-
_ngcontent-c2=""
166-
>
123+
<mat-card>
124+
<mat-card-title>
167125
Login
168126
</mat-card-title>
169-
<mat-card-content
170-
_ngcontent-c2=""
171-
>
127+
<mat-card-content>
172128
<form
173-
_ngcontent-c2=""
174129
class="ng-untouched ng-pristine ng-valid"
175130
ng-reflect-form="[object Object]"
176131
novalidate=""
177132
>
178-
<p
179-
_ngcontent-c2=""
180-
>
181-
<mat-form-field
182-
_ngcontent-c2=""
183-
>
133+
<p>
134+
<mat-form-field>
184135
<input
185-
_ngcontent-c2=""
186136
class="ng-untouched ng-pristine ng-valid"
187137
formcontrolname="username"
188138
matinput=""
@@ -192,14 +142,9 @@ exports[`Login Page should display an error message if provided 1`] = `
192142
/>
193143
</mat-form-field>
194144
</p>
195-
<p
196-
_ngcontent-c2=""
197-
>
198-
<mat-form-field
199-
_ngcontent-c2=""
200-
>
145+
<p>
146+
<mat-form-field>
201147
<input
202-
_ngcontent-c2=""
203148
class="ng-untouched ng-pristine ng-valid"
204149
formcontrolname="password"
205150
matinput=""
@@ -211,17 +156,14 @@ exports[`Login Page should display an error message if provided 1`] = `
211156
</p>
212157
213158
<p
214-
_ngcontent-c2=""
215159
class="loginError"
216160
>
217161
Invalid credentials
218162
</p>
219163
<p
220-
_ngcontent-c2=""
221164
class="loginButtons"
222165
>
223166
<button
224-
_ngcontent-c2=""
225167
mat-button=""
226168
type="submit"
227169
>

projects/example-app/src/app/auth/components/__snapshots__/logout-confirmation-dialog.component.spec.ts.snap

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,19 @@
33
exports[`Logout Confirmation Dialog should compile 1`] = `
44
<ng-component>
55
<h2
6-
_ngcontent-c0=""
76
class="mat-dialog-title"
87
id="mat-dialog-title-0"
98
mat-dialog-title=""
109
>
1110
Logout
1211
</h2><mat-dialog-content
13-
_ngcontent-c0=""
1412
class="mat-dialog-content"
1513
>
1614
Are you sure you want to logout?
1715
</mat-dialog-content><mat-dialog-actions
18-
_ngcontent-c0=""
1916
class="mat-dialog-actions"
2017
>
2118
<button
22-
_ngcontent-c0=""
2319
aria-label="Close dialog"
2420
class="mat-button"
2521
mat-button=""
@@ -43,7 +39,6 @@ exports[`Logout Confirmation Dialog should compile 1`] = `
4339
/>
4440
</button>
4541
<button
46-
_ngcontent-c0=""
4742
aria-label="Close dialog"
4843
class="mat-button"
4944
mat-button=""

0 commit comments

Comments
 (0)