Skip to content

Commit e8e6f8a

Browse files
alan-agius4Keen Yee Liau
authored andcommitted
test: update Ivy tests as per new workspace settings
1 parent beb7070 commit e8e6f8a

File tree

12 files changed

+43
-30
lines changed

12 files changed

+43
-30
lines changed

tests/angular_devkit/build_angular/hello-world-app-ivy/src/tsconfig.app.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,5 @@
1010
],
1111
"include": [
1212
"**/*.d.ts"
13-
],
14-
"angularCompilerOptions": {
15-
"enableIvy": true
16-
}
13+
]
1714
}

tests/angular_devkit/build_angular/hello-world-app-ivy/src/tsconfig.server.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"main.server.ts"
1111
],
1212
"angularCompilerOptions": {
13-
"entryModule": "app/app.server.module#AppServerModule",
14-
"enableIvy": true
13+
"entryModule": "app/app.server.module#AppServerModule"
1514
}
1615
}

tests/angular_devkit/build_angular/hello-world-app-ivy/src/tsconfig.spec.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,5 @@
1414
"include": [
1515
"**/*.spec.ts",
1616
"**/*.d.ts"
17-
],
18-
"angularCompilerOptions": {
19-
"enableIvy": true
20-
}
17+
]
2118
}

tests/angular_devkit/build_angular/hello-world-app-ivy/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,8 @@
1717
"es2017",
1818
"dom"
1919
]
20+
},
21+
"angularCompilerOptions": {
22+
"enableIvy": true
2023
}
2124
}

tests/angular_devkit/build_angular/hello-world-app/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,8 @@
1717
"es2017",
1818
"dom"
1919
]
20+
},
21+
"angularCompilerOptions": {
22+
"enableIvy": false
2023
}
2124
}

tests/angular_devkit/build_ng_packagr/ng-packaged/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,8 @@
1616
"es2017",
1717
"dom"
1818
]
19+
},
20+
"angularCompilerOptions": {
21+
"enableIvy": false
1922
}
2023
}

tests/legacy-cli/e2e/setup/500-create-project.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { getGlobalVariable } from '../utils/env';
33
import { expectFileToExist } from '../utils/fs';
44
import { gitClean } from '../utils/git';
55
import { ng } from '../utils/process';
6-
import { prepareProjectForE2e } from '../utils/project';
6+
import { prepareProjectForE2e, updateJsonFile } from '../utils/project';
77

88
export default async function() {
99
const argv = getGlobalVariable('argv');
@@ -18,13 +18,20 @@ export default async function() {
1818
} else {
1919
const extraArgs = [];
2020

21-
if (argv['ivy']) {
22-
extraArgs.push('--enable-ivy');
23-
}
24-
2521
await ng('new', 'test-project', '--skip-install', ...extraArgs);
2622
await expectFileToExist(join(process.cwd(), 'test-project'));
2723
process.chdir('./test-project');
24+
25+
if (!argv['ivy']) {
26+
await updateJsonFile('tsconfig.json', config => {
27+
config.angularCompilerOptions.enableIvy = false;
28+
});
29+
30+
// In VE non prod builds are non AOT by default
31+
await updateJsonFile('angular.json', config => {
32+
config.projects['test-project'].architect.build.options.aot = false;
33+
});
34+
}
2835
}
2936

3037
await prepareProjectForE2e('test-project');

tests/legacy-cli/e2e/tests/build/lazy-load-syntax.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@ import { getGlobalVariable } from '../../utils/env';
99
import { appendToFile, prependToFile, readFile, replaceInFile, writeFile } from '../../utils/fs';
1010
import { ng } from '../../utils/process';
1111
import { updateJsonFile } from '../../utils/project';
12-
import { expectToFail } from '../../utils/utils';
1312

1413
export default async function () {
15-
const argv = getGlobalVariable('argv');
16-
const ivyProject = argv['ivy'];
1714
const projectName = 'test-project';
1815
const appRoutingModulePath = 'src/app/app-routing.module.ts';
1916

tests/legacy-cli/e2e/tests/generate/library/library-consumption.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import { ng } from '../../../utils/process';
33

44
export default async function () {
55
await ng('generate', 'library', 'my-lib');
6-
await ng('build', 'my-lib');
7-
86
await writeFile('./src/app/app.module.ts', `
97
import { BrowserModule } from '@angular/platform-browser';
108
import { NgModule } from '@angular/core';
@@ -69,6 +67,18 @@ export default async function () {
6967
});
7068
`);
7169

70+
await runLibraryTests();
71+
await runLibraryTests(true);
72+
}
73+
74+
async function runLibraryTests(prodMode = false): Promise<void> {
75+
const args = ['build', 'my-lib'];
76+
if (prodMode) {
77+
args.push('--prod');
78+
}
79+
80+
await ng(...args);
81+
7282
// Check that the tests succeeds both with named project, unnammed (should test app), and prod.
7383
await ng('e2e');
7484
await ng('e2e', 'test-project', '--devServerTarget=test-project:serve:production');

tests/legacy-cli/e2e/tests/ivy/ivy-opt-out.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,20 @@
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 } from '../../utils/fs';
98
import { request } from '../../utils/http';
109
import { killAllProcesses, ng } from '../../utils/process';
11-
import { createProject, ngServe } from '../../utils/project';
10+
import { createProject, ngServe, updateJsonFile } from '../../utils/project';
1211

1312
export default async function() {
1413
try {
15-
await createProject('ivy-project-opt-out', '--enable-ivy');
14+
await createProject('ivy-project-opt-out');
1615
// trigger an Ivy builds to process packages with NGCC
1716
await ng('e2e', '--prod');
1817

1918
// View Engine (NGC) compilation should work after running NGCC from Webpack
20-
await replaceInFile('tsconfig.app.json', '"enableIvy": true', '"enableIvy": false');
19+
await updateJsonFile('tsconfig.json', config => {
20+
config.angularCompilerOptions.enableIvy = false;
21+
});
2122

2223
// verify that VE compilation works during runtime
2324
await ng('e2e', '--prod');

0 commit comments

Comments
 (0)