Skip to content
Closed

wip! #28475

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
os: [windows-latest]
node: [22]
subset: [npm, esbuild]
subset: [npm]
shard: [0, 1, 2, 3, 4, 5]
runs-on: ${{ matrix.os }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion tests/legacy-cli/e2e/tests/build/rebuild-dot-dirname.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default async function () {
try {
process.chdir('./.subdirectory');

await ng('new', 'subdirectory-test-project', '--skip-install');
await ng('new', 'subdirectory-test-project', '--skip-install', '--skip-git');
process.chdir('./subdirectory-test-project');

await useSha();
Expand Down
23 changes: 3 additions & 20 deletions tests/legacy-cli/e2e/utils/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { spawn, SpawnOptions } from 'child_process';
import * as child_process from 'child_process';
import { concat, defer, EMPTY, from, lastValueFrom, catchError, repeat } from 'rxjs';
import { getGlobalVariable, getGlobalVariablesEnv } from './env';
import treeKill from 'tree-kill';
import { delimiter, join, resolve } from 'path';

interface ExecOptions {
Expand Down Expand Up @@ -232,29 +231,13 @@ export function waitForAnyProcessOutputToMatch(
return Promise.race(matchPromises.concat([timeoutPromise]));
}

export async function killAllProcesses(signal = 'SIGTERM'): Promise<void> {
const processesToKill: Promise<void>[] = [];

export async function killAllProcesses(): Promise<void> {
while (_processes.length) {
const childProc = _processes.pop();
if (!childProc || childProc.pid === undefined) {
continue;
if (childProc && !childProc.killed) {
childProc.kill();
}

processesToKill.push(
new Promise<void>((resolve) => {
treeKill(childProc.pid!, signal, () => {
// Ignore all errors.
// This is due to a race condition with the `waitForMatch` logic.
// where promises are resolved on matches and not when the process terminates.
// Also in some cases in windows we get `The operation attempted is not supported`.
resolve();
});
}),
);
}

await Promise.all(processesToKill);
}

export function exec(cmd: string, ...args: string[]) {
Expand Down
4 changes: 3 additions & 1 deletion tests/legacy-cli/e2e_runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as path from 'path';
import { getGlobalVariable, setGlobalVariable } from './e2e/utils/env';
import { gitClean } from './e2e/utils/git';
import { createNpmRegistry } from './e2e/utils/registry';
import { launchTestProcess } from './e2e/utils/process';
import { killAllProcesses, launchTestProcess } from './e2e/utils/process';
import { delimiter, dirname, join } from 'path';
import { findFreePort } from './e2e/utils/network';
import { extractFile } from './e2e/utils/tar';
Expand Down Expand Up @@ -328,6 +328,8 @@ async function runTest(absoluteName: string): Promise<void> {
process.chdir(join(getGlobalVariable('projects-root'), 'test-project'));

await launchTestProcess(absoluteName);
// Ensure that we kill all sub-processes of tests. (Such as `ng serve`).
await killAllProcesses();
await gitClean();
}

Expand Down
Loading