test: migrate node:test imports to vitest and stabilize timing thresholds

- 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) <noreply@anthropic.com>
This commit is contained in:
Mikael Hugo 2026-05-13 21:30:21 +02:00
parent 3f2babb5d1
commit 32cfb6224b
5 changed files with 7 additions and 5 deletions

View file

@ -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") {

View file

@ -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

View file

@ -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,

View file

@ -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`,

View file

@ -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}`);