Skip to content

Commit a9ebfc8

Browse files
Alanvikerman
authored andcommitted
ci: include ivy tests in windows ci
With this change we include ivy tests to run under windows, also this changes `ivy-lazy-load` test to create a project only 1 time. This is important for windows, as `npm install` & `ngcc` take a lot of time, and for this specific test it is done 3 times. Now `npm install` and `ngcc` will only run once
1 parent 345ab48 commit a9ebfc8

File tree

3 files changed

+22
-20
lines changed

3 files changed

+22
-20
lines changed

appveyor-e2e.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
IF not defined APPVEYOR_PULL_REQUEST_NUMBER (
33
IF not defined BUILDKITE_PULL_REQUEST (
44
REM Run full test suite if not on a Appveyor/Buildkite PR.
5-
node tests\legacy-cli\run_e2e.js --appveyor "--glob=tests/{basic,commands,generate,build/styles}/**"
5+
node tests\legacy-cli\run_e2e.js --appveyor "--glob=tests/{basic,commands,generate,build/styles,ivy}/**"
66
exit
77
)
88
)
99

1010
REM Run partial test suite.
11-
node tests\legacy-cli\run_e2e.js --appveyor "--glob=tests/basic/**"
11+
node tests\legacy-cli\run_e2e.js --appveyor "--glob=tests/{basic,ivy}/**"
1212

tests/legacy-cli/e2e/tests/experimental/ivy-lazy-load.ts renamed to tests/legacy-cli/e2e/tests/ivy/ivy-lazy-load.ts

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,35 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.io/license
77
*/
8-
import { replaceInFile, writeFile } from '../../utils/fs';
8+
import { readFile, replaceInFile, writeFile } from '../../utils/fs';
99
import { ng } from '../../utils/process';
1010
import { createProject, updateJsonFile } from '../../utils/project';
1111
import { expectToFail } from '../../utils/utils';
1212

13-
export async function ivyLazyLoadSetup(projectName: string) {
13+
export default async function () {
14+
const projectName = 'ivy-lazy-loading';
15+
const appRoutingModulePath = 'src/app/app-routing.module.ts';
16+
1417
// Make Ivy project.
1518
await createProject(projectName, '--enable-ivy', '--routing');
1619

20+
const originalAppRoutingModule = await readFile(appRoutingModulePath);
21+
// helper to replace loadChildren
22+
const replaceLoadChildren = async (route: string) => {
23+
const content = originalAppRoutingModule.replace('const routes: Routes = [];', `
24+
const routes: Routes = [{ path: 'lazy', loadChildren: ${route} }];
25+
`);
26+
27+
return writeFile(appRoutingModulePath, content);
28+
};
29+
1730
// Add lazy route.
1831
await ng('generate', 'module', 'lazy', '--routing');
19-
await replaceInFile('src/app/app-routing.module.ts', 'const routes: Routes = [];', `
20-
const routes: Routes = [{ path: 'lazy', loadChildren: LOAD_CHILDREN_MARKER }];
21-
`);
2232
await ng('generate', 'component', 'lazy/lazy-comp');
2333
await replaceInFile('src/app/lazy/lazy-routing.module.ts', 'const routes: Routes = [];', `
2434
import { LazyCompComponent } from './lazy-comp/lazy-comp.component';
2535
const routes: Routes = [{ path: '', component: LazyCompComponent }];
2636
`);
27-
await writeFile('src/app/app.component.html', '<router-outlet></router-outlet>');
2837

2938
// Add lazy route e2e
3039
await writeFile('e2e/src/app.e2e-spec.ts', `
@@ -59,30 +68,23 @@ export async function ivyLazyLoadSetup(projectName: string) {
5968
buildTarget['options']['aot'] = false;
6069
buildTarget['configurations']['production'] = { aot: true };
6170
});
62-
}
6371

64-
export default async function () {
6572
// Test `import()` style lazy load.
66-
await ivyLazyLoadSetup('ivy-lazy-import');
67-
await replaceInFile('src/app/app-routing.module.ts', 'LOAD_CHILDREN_MARKER', `
68-
() => import('./lazy/lazy.module').then(m => m.LazyModule)
69-
`);
73+
await replaceLoadChildren(`() => import('./lazy/lazy.module').then(m => m.LazyModule)`);
7074
await ng('e2e');
7175
await ng('e2e', '--prod');
7276

7377
// Test string import with factory shims.
74-
await ivyLazyLoadSetup('ivy-lazy-string-shims');
75-
await replaceInFile('src/app/app-routing.module.ts', 'LOAD_CHILDREN_MARKER',
76-
`'./lazy/lazy.module#LazyModule'`);
78+
await replaceLoadChildren(`'./lazy/lazy.module#LazyModule'`);
7779
await replaceInFile('tsconfig.app.json', `"allowEmptyCodegenFiles": false`,
7880
`"allowEmptyCodegenFiles": true`);
7981
await expectToFail(() => ng('e2e')); // Currently broken.
8082
await ng('e2e', '--prod');
8183

8284
// Test string import without factory shims.
83-
await ivyLazyLoadSetup('ivy-lazy-string-no-shims');
84-
await replaceInFile('src/app/app-routing.module.ts', 'LOAD_CHILDREN_MARKER',
85-
`'./lazy/lazy.module#LazyModule'`);
85+
await replaceLoadChildren(`'./lazy/lazy.module#LazyModule'`);
86+
await replaceInFile('tsconfig.app.json', `"allowEmptyCodegenFiles": true`,
87+
`"allowEmptyCodegenFiles": false`);
8688
await expectToFail(() => ng('e2e')); // Not supported.
8789
await expectToFail(() => ng('e2e', '--prod')); // Not supported.
8890
}
File renamed without changes.

0 commit comments

Comments
 (0)