-
Notifications
You must be signed in to change notification settings - Fork 12k
/
Copy pathaot_spec_large.ts
41 lines (32 loc) · 1.4 KB
/
aot_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
/**
* @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/src/index2';
import { runTargetSpec } from '@angular-devkit/architect/testing';
import { join, normalize, virtualFs } from '@angular-devkit/core';
import { tap } from 'rxjs/operators';
import { BrowserBuilderOutput } from '../../src/browser/index2';
import { browserTargetSpec, createArchitect, host } from '../utils';
describe('Browser Builder AOT', () => {
const targetSpec = { 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 () => {
const overrides = { aot: true };
const run = await architect.scheduleTarget(targetSpec, overrides);
const output = await run.result as BrowserBuilderOutput;
expect(output.success).toBe(true);
const fileName = join(normalize(output.outputPath), 'main.js');
const content = virtualFs.fileBufferToString(await host.read(normalize(fileName)).toPromise());
expect(content).toMatch(/platformBrowser.*bootstrapModuleFactory.*AppModuleNgFactory/);
await run.stop();
});
});