Skip to content

Commit eeae1ed

Browse files
alan-agius4clydin
authored andcommitted
test: reduce disk-cache E2E tests duration
We don't need to include all applications code to verify disk cache existence. This reduces the test duration of `disk-cache.ts` by a whopping `~65s` since this tests runs `ng build` 5 times and `disk-cache-purge.ts` by `~13s`. These timings were gathered using gLinux and is expected that the gain is more significant on Circle CI Linux and Windows executors. (cherry picked from commit e73c968)
1 parent 9d88c96 commit eeae1ed

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

tests/legacy-cli/e2e/tests/build/disk-cache-purge.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import { join } from 'path';
2-
import { createDir, expectFileNotToExist, expectFileToExist } from '../../utils/fs';
2+
import { createDir, expectFileNotToExist, expectFileToExist, writeFile } from '../../utils/fs';
33
import { ng } from '../../utils/process';
44
import { updateJsonFile } from '../../utils/project';
55

66
export default async function () {
77
const cachePath = '.angular/cache';
88
const staleCachePath = join(cachePath, 'v1.0.0');
99

10+
// No need to include all applications code to verify disk cache existence.
11+
await writeFile('src/main.ts', 'console.log(1);');
12+
await writeFile('src/polyfills.ts', 'console.log(1);');
13+
1014
// Enable cache for all environments
1115
await updateJsonFile('angular.json', (config) => {
1216
config.cli ??= {};

tests/legacy-cli/e2e/tests/build/disk-cache.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { expectFileNotToExist, expectFileToExist, rimraf } from '../../utils/fs';
1+
import { expectFileNotToExist, expectFileToExist, rimraf, writeFile } from '../../utils/fs';
22
import { ng } from '../../utils/process';
33
import { updateJsonFile } from '../../utils/project';
44

@@ -8,6 +8,10 @@ const overriddenCachePath = '.cache/angular-cli';
88
export default async function () {
99
const originalCIValue = process.env['CI'];
1010

11+
// No need to include all applications code to verify disk cache existence.
12+
await writeFile('src/main.ts', 'console.log(1);');
13+
await writeFile('src/polyfills.ts', 'console.log(1);');
14+
1115
try {
1216
// Should be enabled by default.
1317
process.env['CI'] = '0';

0 commit comments

Comments
 (0)