-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Expand file tree
/
Copy pathconfig-global.ts
More file actions
42 lines (35 loc) · 1.52 KB
/
config-global.ts
File metadata and controls
42 lines (35 loc) · 1.52 KB
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
import assert from 'node:assert/strict';
import { homedir } from 'node:os';
import * as path from 'node:path';
import { deleteFile, expectFileToExist } from '../../../utils/fs';
import { ng } from '../../../utils/process';
import { expectToFail } from '../../../utils/utils';
export default async function () {
await expectToFail(() =>
ng('config', '--global', 'schematics.@schematics/angular.component.inlineStyle'),
);
await ng('config', '--global', 'schematics.@schematics/angular.component.inlineStyle', 'false');
let output = await ng(
'config',
'--global',
'schematics.@schematics/angular.component.inlineStyle',
);
assert.match(output.stdout, /false\n?/);
// This test requires schema querying capabilities
// .then(() => expectToFail(() => {
// return ng('config', '--global', 'schematics.@schematics/angular.component.inlineStyle', 'INVALID_BOOLEAN');
// }))
const cwd = process.cwd();
process.chdir('/');
try {
await ng('config', '--global', 'schematics.@schematics/angular.component.inlineStyle', 'true');
} finally {
process.chdir(cwd);
}
output = await ng('config', '--global', 'schematics.@schematics/angular.component.inlineStyle');
assert.match(output.stdout, /true\n?/);
await expectToFail(() => ng('config', '--global', 'cli.warnings.notreal', 'true'));
await ng('config', '--global', 'cli.warnings.versionMismatch', 'false');
await expectFileToExist(path.join(homedir(), '.angular-config.json'));
await deleteFile(path.join(homedir(), '.angular-config.json'));
}