File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33// Runs grouped Vitest plans for one or more bundled plugins.
44import path from "node:path" ;
55import pMap from "p-map" ;
6+ import { waitForever } from "../src/cli/wait.ts" ;
67import { collectVitestExcludePatterns } from "../test/vitest/vitest.pattern-file.ts" ;
78import { resolveVitestFsModuleCacheRoot } from "../test/vitest/vitest.performance-config.ts" ;
89import {
@@ -368,10 +369,9 @@ export async function runExtensionBatchPlan(
368369 process . off ( "SIGINT" , onSignal ) ;
369370 if ( termination . signal ) {
370371 process . kill ( process . pid , termination . signal ) ;
371- // Give the re-raised signal a turn before a CLI caller exits with the numeric result.
372- await new Promise < void > ( ( resolve ) => {
373- setImmediate ( resolve ) ;
374- } ) ;
372+ // Keep the loop alive for dependency signal handlers to finish cleanup
373+ // and re-raise; a numeric return can win the race with signal delivery.
374+ await waitForever ( ) ;
375375 }
376376 }
377377 }
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import type { SpawnOptions } from "node:child_process";
44import fs from "node:fs" ;
55import { performance } from "node:perf_hooks" ;
66import pMap from "p-map" ;
7+ import { waitForever } from "../src/cli/wait.ts" ;
78import { formatMs } from "./lib/check-timing-summary.mts" ;
89import {
910 prepareE2eVitestRuntime ,
@@ -471,10 +472,9 @@ async function main() {
471472 process . off ( "SIGINT" , onSignal ) ;
472473 if ( termination . signal ) {
473474 process . kill ( process . pid , termination . signal ) ;
474- // Give the re-raised signal a turn before a CLI caller exits with the numeric result.
475- await new Promise < void > ( ( resolve ) => {
476- setImmediate ( resolve ) ;
477- } ) ;
475+ // Keep the loop alive for dependency signal handlers to finish cleanup
476+ // and re-raise; a numeric return can win the race with signal delivery.
477+ await waitForever ( ) ;
478478 }
479479 }
480480 }
You can’t perform that action at this time.
0 commit comments