From c5c9c6e075992211263c7cdc1c63003441a3e118 Mon Sep 17 00:00:00 2001 From: Ryan de Melo Date: Sat, 15 Aug 2026 12:24:18 +0800 Subject: [PATCH] test: opt the suite out of telemetry 34 test files spawn the real CLI across ~62 call sites. Each spawn runs the preAction hook exactly like a user invocation, so a local `pnpm test` persisted an anonymousId into the developer's real global config (~/.config/openspec/config.json) and POSTed a command_executed event per spawn to the telemetry endpoint. CI never saw this because CI= already disables telemetry; it only happens on contributor machines, where it also skews the maintainers' usage data with test traffic. Set OPENSPEC_TELEMETRY=0 / DO_NOT_TRACK=1 via vitest's env so workers and the CLI children they spawn are both covered. Telemetry's own tests delete these vars before asserting, so they are unaffected. --- vitest.config.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/vitest.config.ts b/vitest.config.ts index bd474d7b72..c2d9435ad8 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -25,6 +25,16 @@ export default defineConfig({ globals: true, environment: 'node', globalSetup: './vitest.setup.ts', + // Opt the suite out of telemetry. Many tests spawn the real CLI, which runs + // the preAction hook like any user invocation: it would persist an + // anonymousId into the developer's *real* global config and POST a + // command_executed event per spawn. Workers inherit this env, and so do the + // CLI child processes they spawn. Telemetry's own tests delete these vars + // before asserting, so they are unaffected. + env: { + OPENSPEC_TELEMETRY: '0', + DO_NOT_TRACK: '1', + }, // Tests rely on per-file process isolation (e.g., `process.cwd()` assumptions). pool: 'forks', maxWorkers: resolveMaxWorkers(),