-
Notifications
You must be signed in to change notification settings - Fork 12k
/
preserve_whitespaces_check_spec.ts
47 lines (41 loc) · 1.52 KB
/
preserve_whitespaces_check_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
36
37
38
39
40
41
42
43
44
45
46
47
/**
* @license
* Copyright Google LLC 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 { logging } from '@angular-devkit/core';
import { execute } from '../../index';
import { BASE_OPTIONS, SERVER_BUILDER_INFO, describeBuilder } from '../setup';
describeBuilder(execute, SERVER_BUILDER_INFO, (harness) => {
describe('Behavior: "preserveWhitespaces warning"', () => {
it('should not show warning when "preserveWhitespaces" is not set.', async () => {
harness.useTarget('server', {
...BASE_OPTIONS,
});
const { logs } = await harness.executeOnce();
expect(logs).not.toContain(
jasmine.objectContaining<logging.LogEntry>({
message: jasmine.stringMatching('"preserveWhitespaces" was set in'),
}),
);
});
it('should show warning when "preserveWhitespaces" is set.', async () => {
harness.useTarget('server', {
...BASE_OPTIONS,
});
await harness.modifyFile('src/tsconfig.server.json', (content) => {
const tsconfig = JSON.parse(content);
(tsconfig.angularCompilerOptions ??= {}).preserveWhitespaces = false;
return JSON.stringify(tsconfig);
});
const { logs } = await harness.executeOnce();
expect(logs).toContain(
jasmine.objectContaining<logging.LogEntry>({
message: jasmine.stringMatching('"preserveWhitespaces" was set in'),
}),
);
});
});
});