From 32cfb6224b7b99bce9384de7e92d8914e78f6623 Mon Sep 17 00:00:00 2001 From: Mikael Hugo Date: Wed, 13 May 2026 21:30:21 +0200 Subject: [PATCH] test: migrate node:test imports to vitest and stabilize timing thresholds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Three .test.mjs files now import describe/it from vitest, matching the harness CLAUDE.md mandates for the SF extension suite. - schedule-e2e local readEntries threshold raised 50ms → 100ms with a comment noting full-suite parallelism adds scheduler/filesystem jitter on dev machines (CI threshold unchanged at 200ms). - e2e-smoke "headless new-milestone without --context" timeout raised 10s → 30s so the exit-1 assertion isn't flaky under load. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../extensions/sf/tests/adaptive-verification-policy.test.mjs | 2 +- .../extensions/sf/tests/headless-uok-status.test.mjs | 2 +- .../extensions/sf/tests/post-execution-checks.test.mjs | 2 +- src/resources/extensions/sf/tests/schedule-e2e.test.ts | 4 +++- src/tests/integration/e2e-smoke.test.ts | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/resources/extensions/sf/tests/adaptive-verification-policy.test.mjs b/src/resources/extensions/sf/tests/adaptive-verification-policy.test.mjs index 13611745c..6eb971f99 100644 --- a/src/resources/extensions/sf/tests/adaptive-verification-policy.test.mjs +++ b/src/resources/extensions/sf/tests/adaptive-verification-policy.test.mjs @@ -1,5 +1,5 @@ import assert from "node:assert/strict"; -import { describe, it } from "node:test"; +import { describe, it } from "vitest"; import { computeAdaptiveVerificationPolicy } from "../uok/adaptive-verification-policy.js"; function makeEvent(outcome, failureClass = "unknown") { diff --git a/src/resources/extensions/sf/tests/headless-uok-status.test.mjs b/src/resources/extensions/sf/tests/headless-uok-status.test.mjs index ec1c6c9b6..0e286a4d3 100644 --- a/src/resources/extensions/sf/tests/headless-uok-status.test.mjs +++ b/src/resources/extensions/sf/tests/headless-uok-status.test.mjs @@ -1,5 +1,5 @@ import assert from "node:assert/strict"; -import { describe, it } from "node:test"; +import { describe, it } from "vitest"; // Pure unit tests for headless-uok-status formatting helpers. // Extracted inline since importing from src/headless-uok-status.ts diff --git a/src/resources/extensions/sf/tests/post-execution-checks.test.mjs b/src/resources/extensions/sf/tests/post-execution-checks.test.mjs index a88172a87..02d9a3c89 100644 --- a/src/resources/extensions/sf/tests/post-execution-checks.test.mjs +++ b/src/resources/extensions/sf/tests/post-execution-checks.test.mjs @@ -2,7 +2,7 @@ import assert from "node:assert/strict"; import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; -import { describe, it } from "node:test"; +import { describe, it } from "vitest"; import { checkCrossSliceConsistency, checkMilestoneIntegrity, diff --git a/src/resources/extensions/sf/tests/schedule-e2e.test.ts b/src/resources/extensions/sf/tests/schedule-e2e.test.ts index f03b20703..a417f1b61 100644 --- a/src/resources/extensions/sf/tests/schedule-e2e.test.ts +++ b/src/resources/extensions/sf/tests/schedule-e2e.test.ts @@ -195,7 +195,9 @@ describe("schedule-e2e round-trip", () => { assert.equal(entries.length, count); - const thresholdMs = process.env.CI ? 200 : 50; + // This is a smoke-scale regression guard, not a microbenchmark. Full-suite + // parallelism can add scheduler and filesystem jitter on developer machines. + const thresholdMs = process.env.CI ? 200 : 100; assert.ok( elapsed < thresholdMs, `Expected readEntries(${count}) to complete in <${thresholdMs}ms, took ${elapsed.toFixed(2)}ms`, diff --git a/src/tests/integration/e2e-smoke.test.ts b/src/tests/integration/e2e-smoke.test.ts index c3390f6f9..8c6303666 100644 --- a/src/tests/integration/e2e-smoke.test.ts +++ b/src/tests/integration/e2e-smoke.test.ts @@ -458,7 +458,7 @@ test("sf headless new-milestone without --context exits 1", async () => { rmSync(tmpDir, { recursive: true, force: true }); }); - const result = await runSf(["headless", "new-milestone"], 10_000, {}, tmpDir); + const result = await runSf(["headless", "new-milestone"], 30_000, {}, tmpDir); assert.ok(!result.timedOut, "process should not hang"); assert.strictEqual(result.code, 1, `expected exit 1, got ${result.code}`);