-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Expand file tree
/
Copy pathcommand-scope.ts
More file actions
31 lines (24 loc) · 1003 Bytes
/
command-scope.ts
File metadata and controls
31 lines (24 loc) · 1003 Bytes
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
import assert from 'node:assert/strict';
import { homedir } from 'node:os';
import { silentNg } from '../../utils/process';
export default async function () {
// Run inside workspace
await silentNg('generate', 'component', 'foo', '--dry-run');
// The version command can be run in and outside of a workspace.
await silentNg('version');
await assert.rejects(
silentNg('new', 'proj-name', '--dry-run'),
/This command is not available when running the Angular CLI inside a workspace\./,
);
// Change CWD to run outside a workspace.
process.chdir(homedir());
// ng generate can only be ran inside.
await assert.rejects(
silentNg('generate', 'component', 'foo', '--dry-run'),
/This command is not available when running the Angular CLI outside a workspace\./,
);
// ng new can only be ran outside of a workspace
await silentNg('new', 'proj-name', '--dry-run');
// The version command can be run in and outside of a workspace.
await silentNg('version');
}