Skip to content

Commit eefa0bf

Browse files
clydinmgechev
authored andcommitted
test: add an E2E test for post-install analytics prompt
1 parent 57189f6 commit eefa0bf

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { createDir, rimraf } from '../../utils/fs';
2+
import {
3+
execWithEnv,
4+
killAllProcesses,
5+
waitForAnyProcessOutputToMatch,
6+
} from '../../utils/process';
7+
8+
const packages = require('../../../../../lib/packages').packages;
9+
10+
export default async function() {
11+
// Create a temporary directory to install the CLI
12+
await createDir('../ask-analytics');
13+
const cwd = process.cwd();
14+
process.chdir('../ask-analytics');
15+
16+
try {
17+
// Install the CLI with TTY force enabled
18+
const execution = execWithEnv(
19+
'npm',
20+
['install', packages['@angular/cli'].tar],
21+
{ ...process.env, 'NG_FORCE_TTY': '1' },
22+
);
23+
24+
// Check if the prompt is shown
25+
await waitForAnyProcessOutputToMatch(/Would you like to share anonymous usage data/);
26+
27+
} finally {
28+
killAllProcesses();
29+
30+
// Cleanup
31+
process.chdir(cwd);
32+
await rimraf('../ask-analytics');
33+
}
34+
}

0 commit comments

Comments
 (0)