-
Notifications
You must be signed in to change notification settings - Fork 12k
/
Copy pathbudgets_spec.ts
35 lines (29 loc) · 1.21 KB
/
budgets_spec.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
/**
* @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 { normalize, virtualFs } from '@angular-devkit/core';
import { createArchitect, host } from '../test-utils';
describe('Dev Server Builder bundle budgets', () => {
const targetSpec = { project: 'app', target: 'serve' };
beforeEach(async () => host.initialize().toPromise());
afterEach(async () => host.restore().toPromise());
it('should ignore budgets', async () => {
const config = host.scopedSync().read(normalize('angular.json'));
const jsonConfig = JSON.parse(virtualFs.fileBufferToString(config));
const buildOptions = jsonConfig.projects.app.targets.build.options;
buildOptions.budgets = [{ type: 'all', maximumError: '100b' }],
buildOptions.optimization = true;
host.writeMultipleFiles({
'angular.json': JSON.stringify(jsonConfig),
});
const architect = (await createArchitect(host.root())).architect;
const run = await architect.scheduleTarget(targetSpec);
const output = await run.result;
expect(output.success).toBe(true);
await run.stop();
});
});