Skip to content

Commit

Permalink
fix(forks): --cpu-prof and --heap-prof not working
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio committed Sep 28, 2024
1 parent 1800167 commit 2e4d894
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/vitest/src/runtime/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ import { disposeInternalListeners } from './workers/utils'

if (isChildProcess()) {
setProcessTitle(`vitest ${poolId}`)

const isProfiling = process.execArgv.some(
execArg =>
execArg.startsWith('--prof')
|| execArg.startsWith('--cpu-prof')
|| execArg.startsWith('--heap-prof')
|| execArg.startsWith('--diagnostic-dir'),
)

if (isProfiling) {
// Work-around for nodejs/node#55094
process.on('SIGTERM', () => {
process.exit()
})
}
}

// this is what every pool executes when running tests
Expand Down

0 comments on commit 2e4d894

Please sign in to comment.