-
Notifications
You must be signed in to change notification settings - Fork 12k
/
Copy pathno-entry-module_spec_large.ts
45 lines (36 loc) · 1.54 KB
/
no-entry-module_spec_large.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { Architect } from '@angular-devkit/architect';
import { TestLogger } from '@angular-devkit/architect/testing';
import { browserBuild, createArchitect, host, veEnabled } from '../utils';
describe('Browser Builder no entry module', () => {
const target = { project: 'app', target: 'build' };
let architect: Architect;
beforeEach(async () => {
await host.initialize().toPromise();
architect = (await createArchitect(host.root())).architect;
});
afterEach(async () => host.restore().toPromise());
it('works', async () => {
// Remove the bootstrap but keep a reference to AppModule so the import is not elided.
host.replaceInFile('src/main.ts', /platformBrowserDynamic.*?bootstrapModule.*?;/, '');
host.appendToFile('src/main.ts', 'console.log(AppModule);');
await browserBuild(architect, host, target, { baseHref: '/myUrl' });
});
it('reports warning when no bootstrap code', async () => {
if (!veEnabled) {
pending('Does not apply to Ivy.');
return;
}
host.replaceInFile('src/main.ts', /./g, '');
host.appendToFile('src/main.ts', `import './app/app.module';`);
const logger = new TestLogger('no-bootstrap');
await browserBuild(architect, host, target, { baseHref: '/myUrl' }, { logger });
expect(logger.includes('Lazy routes discovery is not enabled')).toBe(true);
});
});