Skip to content

Commit 6983773

Browse files
alan-agius4dgp1130
authored andcommitted
test: use execAndWaitForOutputToMatch to match prompt output
Since the prompt will be displayed in the same process on `ng deploy` and `ng lint` we don't need to look for matching outputs in all processes. This also fixes some failures on Windows.
1 parent f70557a commit 6983773

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

tests/legacy-cli/e2e/tests/misc/ask-missing-builder.ts

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,27 @@
1-
import { execWithEnv, killAllProcesses, waitForAnyProcessOutputToMatch } from '../../utils/process';
1+
import { execAndWaitForOutputToMatch, killAllProcesses } from '../../utils/process';
22

33
export default async function () {
44
try {
5-
// Execute a command with TTY force enabled
6-
execWithEnv('ng', ['deploy'], {
7-
...process.env,
8-
NG_FORCE_TTY: '1',
9-
NG_CLI_ANALYTICS: 'false',
10-
});
11-
12-
// Check if the prompt is shown
13-
await waitForAnyProcessOutputToMatch(
5+
// Execute a command with TTY force enabled and check that the prompt is shown.
6+
await execAndWaitForOutputToMatch(
7+
'ng',
8+
['deploy'],
149
/Would you like to add a package with "deploy" capabilities/,
10+
{
11+
...process.env,
12+
NG_FORCE_TTY: '1',
13+
NG_CLI_ANALYTICS: 'false',
14+
},
1515
);
1616

1717
await killAllProcesses();
1818

19-
// Execute a command with TTY force enabled
20-
execWithEnv('ng', ['lint'], {
19+
// Execute a command with TTY force enabled and check that the prompt is shown.
20+
await execAndWaitForOutputToMatch('ng', ['lint'], /Would you like to add ESLint now/, {
2121
...process.env,
2222
NG_FORCE_TTY: '1',
2323
NG_CLI_ANALYTICS: 'false',
2424
});
25-
26-
// Check if the prompt is shown
27-
await waitForAnyProcessOutputToMatch(/Would you like to add ESLint now/);
2825
} finally {
2926
await killAllProcesses();
3027
}

0 commit comments

Comments
 (0)