Skip to content

Commit fd2dbb3

Browse files
alan-agius4filipesilva
authored andcommitted
test(@angular-devkit/build-angular): clean up tests from ViewEngine code
1 parent 8582ddc commit fd2dbb3

26 files changed

+48
-519
lines changed

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

+2-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import { Architect } from '@angular-devkit/architect';
1010
import { BrowserBuilderOutput } from '@angular-devkit/build-angular';
1111
import { join, logging, normalize, virtualFs } from '@angular-devkit/core';
12-
import { createArchitect, host, veEnabled } from '../../test-utils';
12+
import { createArchitect, host } from '../../test-utils';
1313

1414
describe('Browser Builder AOT', () => {
1515
const targetSpec = { project: 'app', target: 'build' };
@@ -31,11 +31,7 @@ describe('Browser Builder AOT', () => {
3131

3232
const fileName = join(normalize(output.outputPath), 'main.js');
3333
const content = virtualFs.fileBufferToString(await host.read(normalize(fileName)).toPromise());
34-
if (!veEnabled) {
35-
expect(content).toContain('AppComponent.ɵcmp');
36-
} else {
37-
expect(content).toMatch(/platformBrowser.*bootstrapModuleFactory.*AppModuleNgFactory/);
38-
}
34+
expect(content).toContain('AppComponent.ɵcmp');
3935

4036
await run.stop();
4137
});

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

+2-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import { Architect } from '@angular-devkit/architect';
1010
import { logging } from '@angular-devkit/core';
11-
import { createArchitect, host, veEnabled } from '../../test-utils';
11+
import { createArchitect, host } from '../../test-utils';
1212

1313
describe('Browser Builder errors', () => {
1414
const targetSpec = { project: 'app', target: 'build' };
@@ -68,11 +68,7 @@ describe('Browser Builder errors', () => {
6868
// Wait for the builder to complete
6969
await run.stop();
7070

71-
if (!veEnabled) {
72-
expect(logs.join()).toContain('selector must be a string');
73-
} else {
74-
expect(logs.join()).toContain('Function expressions are not supported in');
75-
}
71+
expect(logs.join()).toContain('selector must be a string');
7672
});
7773

7874
it('shows missing export errors', async () => {

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

-130
This file was deleted.

packages/angular_devkit/build_angular/src/browser/specs/lazy-module_spec.ts

+3-8
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {
1616
host,
1717
lazyModuleFiles,
1818
lazyModuleFnImport,
19-
veEnabled,
2019
} from '../../test-utils';
2120

2221
// tslint:disable-next-line:no-big-function
@@ -68,13 +67,9 @@ describe('Browser Builder lazy modules', () => {
6867
addLazyLoadedModulesInTsConfig(host, lazyModuleFiles);
6968

7069
const { files } = await browserBuild(architect, host, target, { aot: true });
71-
if (!veEnabled) {
72-
const data = await files['lazy-lazy-module.js'];
73-
expect(data).not.toBeUndefined('Lazy module output bundle does not exist');
74-
expect(data).toContain('LazyModule.ɵmod');
75-
} else {
76-
expect(files['lazy-lazy-module-ngfactory.js']).not.toBeUndefined();
77-
}
70+
const data = await files['lazy-lazy-module.js'];
71+
expect(data).not.toBeUndefined('Lazy module output bundle does not exist');
72+
expect(data).toContain('LazyModule.ɵmod');
7873
});
7974
});
8075

packages/angular_devkit/build_angular/src/browser/specs/no-entry-module_spec.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
*/
88

99
import { Architect } from '@angular-devkit/architect';
10-
import { logging } from '@angular-devkit/core';
11-
import { browserBuild, createArchitect, host, veEnabled } from '../../test-utils';
10+
import { browserBuild, createArchitect, host } from '../../test-utils';
1211

1312
describe('Browser Builder no entry module', () => {
1413
const target = { project: 'app', target: 'build' };

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

+2-11
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
lazyModuleFiles,
1616
lazyModuleFnImport,
1717
outputPath,
18-
veEnabled,
1918
} from '../../test-utils';
2019

2120
describe('Browser Builder rebuilds', () => {
@@ -225,12 +224,6 @@ describe('Browser Builder rebuilds', () => {
225224
});
226225

227226
it('rebuilds on transitive type-only file changes', async () => {
228-
if (veEnabled) {
229-
// TODO: https://github.com/angular/angular-cli/issues/15056
230-
pending('Only supported in Ivy.');
231-
232-
return;
233-
}
234227
host.writeMultipleFiles({
235228
'src/interface1.ts': `
236229
import { Interface2 } from './interface2';
@@ -351,13 +344,11 @@ describe('Browser Builder rebuilds', () => {
351344
// `selector must be a string` errors on VE are part of the emit result, but on Ivy they only
352345
// show up in getNgSemanticDiagnostics. Since getNgSemanticDiagnostics is only called on the
353346
// type checker, we must disable it to get a failing fourth build with Ivy.
354-
const overrides = { watch: true, aot: true, forkTypeChecker: veEnabled };
347+
const overrides = { watch: true, aot: true, forkTypeChecker: false };
355348
const logger = new logging.Logger('');
356349
let logs: string[] = [];
357350
logger.subscribe(e => logs.push(e.message));
358-
const staticAnalysisError = !veEnabled
359-
? 'selector must be a string'
360-
: 'Function expressions are not supported in decorators';
351+
const staticAnalysisError = 'selector must be a string';
361352
const syntaxError = 'Declaration or statement expected.';
362353
let buildNumber = 0;
363354

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

+2-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88
import { Architect } from '@angular-devkit/architect';
99
import { join, normalize, virtualFs } from '@angular-devkit/core';
10-
import { createArchitect, host, outputPath, veEnabled } from '../../test-utils';
10+
import { createArchitect, host, outputPath } from '../../test-utils';
1111

1212
describe('Browser Builder allow svg', () => {
1313
const target = { project: 'app', target: 'build' };
@@ -55,11 +55,7 @@ describe('Browser Builder allow svg', () => {
5555
host.scopedSync().read(join(outputPath, 'main.js')),
5656
);
5757

58-
if (!veEnabled) {
59-
expect(content).toContain('ɵɵnamespaceSVG');
60-
} else {
61-
expect(content).toContain('":svg:svg"');
62-
}
58+
expect(content).toContain('ɵɵnamespaceSVG');
6359
expect(host.scopedSync().exists(normalize('dist/app.component.svg'))).toBe(
6460
false,
6561
'should not copy app.component.svg to dist',

packages/angular_devkit/build_angular/src/browser/specs/unused-files-warning_spec.ts

+1-50
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Architect } from '@angular-devkit/architect';
99
import { BrowserBuilderOutput } from '@angular-devkit/build-angular';
1010
import { logging } from '@angular-devkit/core';
1111
import { debounceTime, take, tap } from 'rxjs/operators';
12-
import { createArchitect, host, veEnabled } from '../../test-utils';
12+
import { createArchitect, host } from '../../test-utils';
1313

1414
// tslint:disable-next-line:no-big-function
1515
describe('Browser Builder unused files warnings', () => {
@@ -25,13 +25,6 @@ describe('Browser Builder unused files warnings', () => {
2525
afterEach(async () => host.restore().toPromise());
2626

2727
it('should not show warning when all files are used', async () => {
28-
if (veEnabled) {
29-
// TODO: https://github.com/angular/angular-cli/issues/15056
30-
pending('Only supported in Ivy.');
31-
32-
return;
33-
}
34-
3528
const logger = new logging.Logger('');
3629
const logs: string[] = [];
3730
logger.subscribe(e => logs.push(e.message));
@@ -45,13 +38,6 @@ describe('Browser Builder unused files warnings', () => {
4538
});
4639

4740
it('should show warning when some files are unused', async () => {
48-
if (veEnabled) {
49-
// TODO: https://github.com/angular/angular-cli/issues/15056
50-
pending('Only supported in Ivy.');
51-
52-
return;
53-
}
54-
5541
host.replaceInFile(
5642
'src/tsconfig.app.json',
5743
'"main.ts"',
@@ -71,13 +57,6 @@ describe('Browser Builder unused files warnings', () => {
7157
});
7258

7359
it('should not show warning when excluded files are unused', async () => {
74-
if (veEnabled) {
75-
// TODO: https://github.com/angular/angular-cli/issues/15056
76-
pending('Only supported in Ivy.');
77-
78-
return;
79-
}
80-
8160
const ignoredFiles = {
8261
'src/file.d.ts': 'export type MyType = number;',
8362
};
@@ -109,13 +88,6 @@ describe('Browser Builder unused files warnings', () => {
10988
});
11089

11190
it('should not show warning when type files are used', async () => {
112-
if (veEnabled) {
113-
// TODO: https://github.com/angular/angular-cli/issues/15056
114-
pending('Only supported in Ivy.');
115-
116-
return;
117-
}
118-
11991
host.writeMultipleFiles({
12092
'src/app/type.ts': 'export type MyType = number;',
12193
});
@@ -139,13 +111,6 @@ describe('Browser Builder unused files warnings', () => {
139111
});
140112

141113
it('should not show warning when type files are used transitively', async () => {
142-
if (veEnabled) {
143-
// TODO: https://github.com/angular/angular-cli/issues/15056
144-
pending('Only supported in Ivy.');
145-
146-
return;
147-
}
148-
149114
host.writeMultipleFiles({
150115
'src/app/type.ts':
151116
`import {Myinterface} from './interface'; export type MyType = Myinterface;`,
@@ -171,13 +136,6 @@ describe('Browser Builder unused files warnings', () => {
171136
});
172137

173138
it('works for rebuilds', async () => {
174-
if (veEnabled) {
175-
// TODO: https://github.com/angular/angular-cli/issues/15056
176-
pending('Only supported in Ivy.');
177-
178-
return;
179-
}
180-
181139
host.replaceInFile(
182140
'src/tsconfig.app.json',
183141
'"**/*.d.ts"',
@@ -242,13 +200,6 @@ describe('Browser Builder unused files warnings', () => {
242200
});
243201

244202
it('should only show warning once per file', async () => {
245-
if (veEnabled) {
246-
// TODO: https://github.com/angular/angular-cli/issues/15056
247-
pending('Only supported in Ivy.');
248-
249-
return;
250-
}
251-
252203
host.replaceInFile(
253204
'src/tsconfig.app.json',
254205
'"**/*.d.ts"',

0 commit comments

Comments
 (0)