Skip to content

Commit 2e4d894

Browse files
committed
fix(forks): --cpu-prof and --heap-prof not working
1 parent 1800167 commit 2e4d894

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

packages/vitest/src/runtime/worker.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,21 @@ import { disposeInternalListeners } from './workers/utils'
1111

1212
if (isChildProcess()) {
1313
setProcessTitle(`vitest ${poolId}`)
14+
15+
const isProfiling = process.execArgv.some(
16+
execArg =>
17+
execArg.startsWith('--prof')
18+
|| execArg.startsWith('--cpu-prof')
19+
|| execArg.startsWith('--heap-prof')
20+
|| execArg.startsWith('--diagnostic-dir'),
21+
)
22+
23+
if (isProfiling) {
24+
// Work-around for nodejs/node#55094
25+
process.on('SIGTERM', () => {
26+
process.exit()
27+
})
28+
}
1429
}
1530

1631
// this is what every pool executes when running tests

0 commit comments

Comments
 (0)