Skip to content

Commit 8c9b2a2

Browse files
clydinalan-agius4
authored andcommitted
test(@angular-devkit/build-angular): remove unneeded custom Jasmine test timeouts
The default Jasmine test timeout is set to 2.5 minutes for all builder tests. The smaller timeouts (that are now removed from individual tests) can lead to test flakes especially on CI which can have large performance variability.
1 parent 9f331e2 commit 8c9b2a2

File tree

9 files changed

+38
-38
lines changed

9 files changed

+38
-38
lines changed

packages/angular_devkit/build_angular/src/browser/specs/styles_spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ describe('Browser Builder styles', () => {
266266

267267
const overrides = { extractCss: true, styles: [`src/styles.scss`] };
268268
await browserBuild(architect, host, target, overrides);
269-
}, 30000);
269+
});
270270

271271
it(`supports font-awesome imports (tilde)`, async () => {
272272
host.writeMultipleFiles({
@@ -278,7 +278,7 @@ describe('Browser Builder styles', () => {
278278

279279
const overrides = { extractCss: true, styles: [`src/styles.scss`] };
280280
await browserBuild(architect, host, target, overrides);
281-
}, 30000);
281+
});
282282

283283
it(`supports font-awesome imports without extractCss`, async () => {
284284
host.writeMultipleFiles({
@@ -289,7 +289,7 @@ describe('Browser Builder styles', () => {
289289

290290
const overrides = { extractCss: false, styles: [`src/styles.scss`] };
291291
await browserBuild(architect, host, target, overrides);
292-
}, 30000);
292+
});
293293

294294
it(`uses autoprefixer`, async () => {
295295
host.writeMultipleFiles({
@@ -456,7 +456,7 @@ describe('Browser Builder styles', () => {
456456
main = await files['main.js'];
457457
expect(styles).toContain(`url('/assets/global-img-absolute.svg')`);
458458
expect(main).toContain(`url('/assets/component-img-absolute.svg')`);
459-
}, 90000);
459+
});
460460

461461
it(`supports bootstrap@4 with full path`, async () => {
462462
const bootstrapPath = dirname(require.resolve('bootstrap/package.json'));

packages/angular_devkit/build_angular/src/dev-server/hmr_spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ describe('Dev Server Builder HMR', () => {
112112
take(2),
113113
)
114114
.toPromise();
115-
}, 30000);
115+
});
116116

117117
it('works for TS changes', async () => {
118118
const run = await architect.scheduleTarget(target, overrides);
@@ -147,7 +147,7 @@ describe('Dev Server Builder HMR', () => {
147147
take(2),
148148
)
149149
.toPromise();
150-
}, 30000);
150+
});
151151

152152
it('restores input and select values', async () => {
153153
const run = await architect.scheduleTarget(target, overrides);
@@ -191,5 +191,5 @@ describe('Dev Server Builder HMR', () => {
191191
take(2),
192192
)
193193
.toPromise();
194-
}, 30000);
194+
});
195195
});

packages/angular_devkit/build_angular/src/dev-server/live-reload_spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ describe('Dev Server Builder live-reload', () => {
184184
take(2),
185185
)
186186
.toPromise();
187-
}, 30000);
187+
});
188188

189189
it('works without http -> http proxy', async () => {
190190
const run = await architect.scheduleTarget(target, overrides);
@@ -215,7 +215,7 @@ describe('Dev Server Builder live-reload', () => {
215215
take(2),
216216
)
217217
.toPromise();
218-
}, 30000);
218+
});
219219

220220
it('works without https -> http proxy', async () => {
221221
const run = await architect.scheduleTarget(target, overrides);
@@ -246,7 +246,7 @@ describe('Dev Server Builder live-reload', () => {
246246
take(2),
247247
)
248248
.toPromise();
249-
}, 30000);
249+
});
250250

251251
it('works without https -> http proxy without websockets (dotnet emulation)', async () => {
252252
const run = await architect.scheduleTarget(target, overrides);
@@ -279,5 +279,5 @@ describe('Dev Server Builder live-reload', () => {
279279
take(2),
280280
)
281281
.toPromise();
282-
}, 30000);
282+
});
283283
});

packages/angular_devkit/build_angular/src/dev-server/ssl_spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe('Dev Server Builder ssl', () => {
4040
agent: new https.Agent({ rejectUnauthorized: false }),
4141
});
4242
expect(await response.text()).toContain('<title>HelloWorldApp</title>');
43-
}, 30000);
43+
});
4444

4545
it('supports key and cert', async () => {
4646
host.writeMultipleFiles({
@@ -116,5 +116,5 @@ describe('Dev Server Builder ssl', () => {
116116
agent: new https.Agent({ rejectUnauthorized: false }),
117117
});
118118
expect(await response.text()).toContain('<title>HelloWorldApp</title>');
119-
}, 30000);
119+
});
120120
});

packages/angular_devkit/build_angular/src/dev-server/works_spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('Dev Server Builder', () => {
3636

3737
const response = await fetch('http://localhost:4200/index.html');
3838
expect(await response.text()).toContain('<title>HelloWorldApp</title>');
39-
}, 30000);
39+
});
4040

4141
it(`doesn't serve files on the cwd directly`, async () => {
4242
const run = await architect.scheduleTarget(target);
@@ -98,7 +98,7 @@ describe('Dev Server Builder', () => {
9898
expect(output.success).toBe(true);
9999
const response = await fetch('http://localhost:4200/index.html');
100100
expect(response.headers.get('X-Header')).toBe('Hello World');
101-
}, 30000);
101+
});
102102

103103
it('uses source locale when not localizing', async () => {
104104
const config = host.scopedSync().read(normalize('angular.json'));

packages/angular_devkit/build_angular/src/extract-i18n/works_spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('Extract i18n Target', () => {
3636
const content = virtualFs.fileBufferToString(host.scopedSync().read(extractionFile));
3737
expect(content).toContain('i18n test');
3838
}
39-
}, 30000);
39+
});
4040

4141
it('does not emit the application files', async () => {
4242
host.appendToFile('src/app/app.component.html', '<p i18n>i18n test</p>');
@@ -48,7 +48,7 @@ describe('Extract i18n Target', () => {
4848
await run.stop();
4949

5050
expect(host.scopedSync().exists(normalize('dist/app/main.js'))).toBeFalse();
51-
}, 30000);
51+
});
5252

5353
it('shows errors', async () => {
5454
const logger = new logging.Logger('');
@@ -65,7 +65,7 @@ describe('Extract i18n Target', () => {
6565
await run.stop();
6666

6767
expect(logs.join()).toMatch('Cannot mark an element as translatable inside of a translatable section');
68-
}, 30000);
68+
});
6969

7070
it('supports out file', async () => {
7171
host.appendToFile('src/app/app.component.html', '<p i18n>i18n test</p>');
@@ -82,7 +82,7 @@ describe('Extract i18n Target', () => {
8282
expect(host.scopedSync().exists(extractionFile)).toBe(true);
8383
expect(virtualFs.fileBufferToString(host.scopedSync().read(extractionFile)))
8484
.toMatch(/i18n test/);
85-
}, 30000);
85+
});
8686

8787
it('supports output path', async () => {
8888
host.appendToFile('src/app/app.component.html', '<p i18n>i18n test</p>');
@@ -100,7 +100,7 @@ describe('Extract i18n Target', () => {
100100
expect(host.scopedSync().exists(extractionFile)).toBe(true);
101101
expect(virtualFs.fileBufferToString(host.scopedSync().read(extractionFile)))
102102
.toMatch(/i18n test/);
103-
}, 30000);
103+
});
104104

105105
it('supports i18n format', async () => {
106106
host.appendToFile('src/app/app.component.html', '<p i18n>i18n test</p>');
@@ -116,7 +116,7 @@ describe('Extract i18n Target', () => {
116116
expect(host.scopedSync().exists(extractionFile)).toBe(true);
117117
expect(virtualFs.fileBufferToString(host.scopedSync().read(extractionFile)))
118118
.toMatch(/i18n test/);
119-
}, 30000);
119+
});
120120

121121
it('issues warnings for duplicate message identifiers', async () => {
122122
host.appendToFile(
@@ -140,5 +140,5 @@ describe('Extract i18n Target', () => {
140140
'Duplicate messages with id',
141141
);
142142

143-
}, 30000);
143+
});
144144
});

packages/angular_devkit/build_angular/src/karma/code-coverage_spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ describe('Karma Builder code coverage', () => {
5252
expect(content).toContain('app.component.ts');
5353
expect(content).toContain('test.ts');
5454
}
55-
}, 120000);
55+
});
5656

5757
it('supports code coverage exclude option', async () => {
5858
const overrides = {
@@ -78,7 +78,7 @@ describe('Karma Builder code coverage', () => {
7878
const content = virtualFs.fileBufferToString(host.scopedSync().read(coverageFilePath));
7979
expect(content).not.toContain('test.ts');
8080
}
81-
}, 120000);
81+
});
8282

8383
it(`should collect coverage from paths in 'sourceRoot'`, async () => {
8484
const files: { [path: string]: string } = {
@@ -130,7 +130,7 @@ describe('Karma Builder code coverage', () => {
130130
const content = virtualFs.fileBufferToString(host.scopedSync().read(coverageFilePath));
131131
expect(content).not.toContain('my-lib');
132132
}
133-
}, 120000);
133+
});
134134

135135
it('should exit with non-zero code when coverage is below threshold', async () => {
136136
host.replaceInFile('karma.conf.js', 'coverageReporter: {', `
@@ -168,7 +168,7 @@ describe('Karma Builder code coverage', () => {
168168

169169
await run.stop();
170170

171-
}, 120000);
171+
});
172172

173173
it('is able to process coverage plugin provided as string', async () => {
174174
host.replaceInFile('karma.conf.js', /plugins: \[.+?\]/s, `plugins: [
@@ -183,7 +183,7 @@ describe('Karma Builder code coverage', () => {
183183
const {success} = await run.result;
184184
expect(success).toBe(true);
185185
await run.stop();
186-
}, 120000);
186+
});
187187

188188
it('is able to process coverage plugins provided as string karma-*', async () => {
189189
host.replaceInFile('karma.conf.js', /plugins: \[.+?\]/s, `plugins: [
@@ -195,5 +195,5 @@ describe('Karma Builder code coverage', () => {
195195
const {success} = await run.result;
196196
expect(success).toBe(true);
197197
await run.stop();
198-
}, 120000);
198+
});
199199
});

packages/angular_devkit/build_angular/src/protractor/works_spec.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('Protractor Builder', () => {
2525
await expectAsync(run.result).toBeResolvedTo(jasmine.objectContaining({ success: true }));
2626

2727
await run.stop();
28-
}, 30000);
28+
});
2929

3030
it('fails with no devServerTarget and no standalone server', async () => {
3131
const overrides = { devServerTarget: undefined } as unknown as JsonObject;
@@ -34,7 +34,7 @@ describe('Protractor Builder', () => {
3434
await expectAsync(run.result).toBeResolvedTo(jasmine.objectContaining({ success: false }));
3535

3636
await run.stop();
37-
}, 30000);
37+
});
3838

3939
it('overrides protractor specs', async () => {
4040
host.scopedSync().rename(
@@ -48,7 +48,7 @@ describe('Protractor Builder', () => {
4848
await expectAsync(run.result).toBeResolvedTo(jasmine.objectContaining({ success: true }));
4949

5050
await run.stop();
51-
}, 60000);
51+
});
5252

5353
it('overrides protractor suites', async () => {
5454
host.scopedSync().rename(
@@ -70,7 +70,7 @@ describe('Protractor Builder', () => {
7070
await expectAsync(run.result).toBeResolvedTo(jasmine.objectContaining({ success: true }));
7171

7272
await run.stop();
73-
}, 60000);
73+
});
7474

7575
it('supports automatic port assignment (port = 0)', async () => {
7676
const overrides = { port: 0 };
@@ -79,7 +79,7 @@ describe('Protractor Builder', () => {
7979
await expectAsync(run.result).toBeResolvedTo(jasmine.objectContaining({ success: true }));
8080

8181
await run.stop();
82-
}, 30000);
82+
});
8383

8484
it('supports dev server builder with browser builder base HREF option', async () => {
8585
host.replaceInFile(
@@ -95,7 +95,7 @@ describe('Protractor Builder', () => {
9595
await expectAsync(run.result).toBeResolvedTo(jasmine.objectContaining({ success: true }));
9696

9797
await run.stop();
98-
}, 30000);
98+
});
9999

100100
it('supports running tests by pattern', async () => {
101101
host.writeMultipleFiles({
@@ -112,7 +112,7 @@ describe('Protractor Builder', () => {
112112
await expectAsync(run.result).toBeResolvedTo(jasmine.objectContaining({ success: true }));
113113

114114
await run.stop();
115-
}, 30000);
115+
});
116116

117117
it('supports running tests excluding a pattern', async () => {
118118
host.writeMultipleFiles({
@@ -129,5 +129,5 @@ describe('Protractor Builder', () => {
129129
await expectAsync(run.result).toBeResolvedTo(jasmine.objectContaining({ success: true }));
130130

131131
await run.stop();
132-
}, 30000);
132+
});
133133
});

packages/angular_devkit/build_angular/src/tslint/works_spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('Tslint Target', () => {
4848
const output = await run.result;
4949
expect(output.success).toBe(true);
5050
await run.stop();
51-
}, 30000);
51+
});
5252

5353
it(`should show project name as status and in the logs`, async () => {
5454
// Check logs.
@@ -99,7 +99,7 @@ describe('Tslint Target', () => {
9999
expect(allStatus).toContain(jasmine.stringMatching(/linting.*"app".*/i));
100100
expect(allLogs).not.toContain(jasmine.stringMatching(/linting.*"app".*/i));
101101
await run.stop();
102-
}, 30000);
102+
});
103103

104104
// it('should report lint error once', (done) => {
105105
// host.writeMultipleFiles({'src/app/app.component.ts': 'const foo = "";\n' });

0 commit comments

Comments
 (0)