Skip to content

Commit e2c7502

Browse files
alan-agius4clydin
authored andcommitted
test: split module resolutions E2E in multiple tests
This test does a large number of builds by spliting the tests, in CI we can reduce the blocking time for other tests. Locally this tests take ~3 mins in CI.
1 parent e41dc3e commit e2c7502

File tree

3 files changed

+86
-84
lines changed

3 files changed

+86
-84
lines changed

tests/legacy-cli/e2e/tests/misc/module-resolution.ts

Lines changed: 0 additions & 84 deletions
This file was deleted.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { createDir, moveFile } from '../../../utils/fs';
2+
import { ng } from '../../../utils/process';
3+
import { updateJsonFile } from '../../../utils/project';
4+
import { expectToFail } from '../../../utils/utils';
5+
6+
export default async function () {
7+
await updateJsonFile('tsconfig.json', (tsconfig) => {
8+
tsconfig.compilerOptions.paths = {
9+
'*': ['./node_modules/*'],
10+
};
11+
});
12+
await ng('build', '--configuration=development');
13+
14+
await createDir('xyz');
15+
await moveFile('node_modules/@angular/common', 'xyz/common');
16+
await expectToFail(() => ng('build', '--configuration=development'));
17+
18+
await updateJsonFile('tsconfig.json', (tsconfig) => {
19+
tsconfig.compilerOptions.paths = {
20+
'@angular/common': ['./xyz/common'],
21+
};
22+
});
23+
await ng('build', '--configuration=development');
24+
25+
await updateJsonFile('tsconfig.json', (tsconfig) => {
26+
tsconfig.compilerOptions.paths = {
27+
'*': ['./node_modules/*'],
28+
'@angular/common': ['./xyz/common'],
29+
};
30+
});
31+
await ng('build', '--configuration=development');
32+
33+
await updateJsonFile('tsconfig.json', (tsconfig) => {
34+
tsconfig.compilerOptions.paths = {
35+
'@angular/common': ['./xyz/common'],
36+
'*': ['./node_modules/*'],
37+
};
38+
});
39+
await ng('build', '--configuration=development');
40+
await moveFile('xyz/common', 'node_modules/@angular/common');
41+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { appendToFile, prependToFile } from '../../../utils/fs';
2+
import { installPackage } from '../../../utils/packages';
3+
import { ng } from '../../../utils/process';
4+
import { updateJsonFile } from '../../../utils/project';
5+
import { expectToFail } from '../../../utils/utils';
6+
7+
export default async function () {
8+
await updateJsonFile('tsconfig.json', (tsconfig) => {
9+
delete tsconfig.compilerOptions.paths;
10+
});
11+
12+
await prependToFile('src/app/app.module.ts', "import * as firebase from 'firebase';");
13+
await appendToFile('src/app/app.module.ts', 'firebase.initializeApp({});');
14+
15+
await installPackage('[email protected]');
16+
await ng('build', '--aot', '--configuration=development');
17+
18+
await updateJsonFile('tsconfig.json', (tsconfig) => {
19+
tsconfig.compilerOptions.paths = {};
20+
});
21+
22+
await ng('build', '--configuration=development');
23+
await updateJsonFile('tsconfig.json', (tsconfig) => {
24+
tsconfig.compilerOptions.paths = {
25+
'@app/*': ['*'],
26+
'@lib/*/test': ['*/test'],
27+
};
28+
});
29+
30+
await ng('build', '--configuration=development');
31+
await updateJsonFile('tsconfig.json', (tsconfig) => {
32+
tsconfig.compilerOptions.paths = {
33+
'@firebase/polyfill': ['./node_modules/@firebase/polyfill/index.ts'],
34+
};
35+
});
36+
37+
await expectToFail(() => ng('build', '--configuration=development'));
38+
39+
await updateJsonFile('tsconfig.json', (tsconfig) => {
40+
tsconfig.compilerOptions.paths = {
41+
'@firebase/polyfill*': ['./node_modules/@firebase/polyfill/index.ts'],
42+
};
43+
});
44+
await expectToFail(() => ng('build', '--configuration=development'));
45+
}

0 commit comments

Comments
 (0)