From be64cc8d0c3658330d610568dde21654b340ed8b Mon Sep 17 00:00:00 2001 From: Vladimir Sheremet Date: Wed, 27 Sep 2023 14:58:48 +0200 Subject: [PATCH 1/2] feat: include "vitest" in activity monitor --- packages/vitest/src/node/cli.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/vitest/src/node/cli.ts b/packages/vitest/src/node/cli.ts index 287ec9a7d950..758f93b5989f 100644 --- a/packages/vitest/src/node/cli.ts +++ b/packages/vitest/src/node/cli.ts @@ -167,6 +167,8 @@ function normalizeCliOptions(argv: CliOptions): CliOptions { } async function start(mode: VitestRunMode, cliFilters: string[], options: CliOptions): Promise { + process.title = 'node (vitest)' + try { const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(options)) if (!ctx?.shouldKeepServer()) From fc6330b8e9dba5f11435e17867439f55d0aeda62 Mon Sep 17 00:00:00 2001 From: Vladimir Sheremet Date: Wed, 27 Sep 2023 19:32:42 +0200 Subject: [PATCH 2/2] chore: change child_process title --- packages/vitest/src/node/cli.ts | 5 ++++- packages/vitest/src/runtime/child.ts | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/vitest/src/node/cli.ts b/packages/vitest/src/node/cli.ts index 758f93b5989f..c12088fe9e85 100644 --- a/packages/vitest/src/node/cli.ts +++ b/packages/vitest/src/node/cli.ts @@ -167,7 +167,10 @@ function normalizeCliOptions(argv: CliOptions): CliOptions { } async function start(mode: VitestRunMode, cliFilters: string[], options: CliOptions): Promise { - process.title = 'node (vitest)' + try { + process.title = 'node (vitest)' + } + catch {} try { const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(options)) diff --git a/packages/vitest/src/runtime/child.ts b/packages/vitest/src/runtime/child.ts index b1b1d915b4f4..446ad4ac5d97 100644 --- a/packages/vitest/src/runtime/child.ts +++ b/packages/vitest/src/runtime/child.ts @@ -19,6 +19,11 @@ async function init(ctx: ChildContext) { process.env.VITEST_WORKER_ID = String(workerId) process.env.VITEST_POOL_ID = String(poolId) + try { + process.title = `node (vitest ${poolId})` + } + catch {} + let setCancel = (_reason: CancelReason) => {} const onCancel = new Promise((resolve) => { setCancel = resolve