import { defineConfig } from "vitest/config";

export default defineConfig({
  test: {
    environment: "node",
    // narrow to `src/tools/__tests__/` so vitest does not pick up
    // pre-existing `src/lib/__tests__/` files that use Node's built-in
    // `node:test` runner (schema-loader / schema-validator / llm-classifier
    // tests). Those files run under their own harness; broadening
    // this glob to `src/**/__tests__/**` would surface them as parse failures
    // here without porting them.
    //
    // `live-schema-source.test.ts` is whitelisted explicitly because Task 167
    // ported it to vitest (drift-summary surface change). The other lib
    // tests stay node:test.
    include: [
      "src/tools/__tests__/**/*.test.ts",
      "src/lib/__tests__/live-schema-source.test.ts",
      // Task 207 — Vitest-style test for `readPassword()` fallback path math.
      "src/lib/__tests__/neo4j-password-path.test.ts",
      // Task 358 — schema-doc / schema.cypher drift guard.
      "src/lib/__tests__/schema-cypher-drift.test.ts",
      // Task 636 — VECTOR_INDEXED_LABELS / schema.cypher drift guard.
      "src/lib/__tests__/vector-indexed-labels-drift.test.ts",
      // Task 636 — chokepoint embed safety net.
      "src/lib/__tests__/graph-write-embed-net.test.ts",
      "src/lib/__tests__/document-sectioniser.test.ts",
      // Task 350 — label-origin gate (refuse agent-side LocalBusiness writes).
      "src/lib/__tests__/label-origin-gate.test.ts",
      // Task 443 — label-delete gate (refuse agent-side LocalBusiness deletes).
      "src/lib/__tests__/label-delete-gate.test.ts",
      // Task 305 — typed-edge allowlist schema invariants.
      "src/lib/__tests__/typed-edge-schema.test.ts",
      // Task 306 — compiled-truth + timeline.
      "src/lib/__tests__/timeline-extractor.test.ts",
      "src/lib/__tests__/graph-write-gate-property.test.ts",
      // Task 391 — compiled-truth revision history.
      "src/lib/__tests__/graph-write-gate-label.test.ts",
      "src/lib/__tests__/phase-prune-revisions.test.ts",
      // Task 390 — relative-date parser shared by extractor + datetime skill.
      "src/lib/__tests__/relative-date.test.ts",
      // Task 436 — revision-stamping restored under the specialist gate
      // (single-TX SET + revision CREATE).
      "src/lib/__tests__/compiled-truth-revision.test.ts",
    ],
    testTimeout: 10_000,
  },
});
