Files
sencho/backend/vitest.config.ts
Anso 3f1f15a6f4 fix: keep running containers until stack pull/build succeeds (#1657)
* fix: keep running containers until stack pull/build succeeds

Acquire images before reconcile, capture a recovery generation for
compensation, and only remove classified orphans after handoff.

* fix: address recovery audit blockers for safe stack updates

Retire abandoned and expired recovery artifacts, probe compensated
runtimes before reporting rollback success, preserve local Docker when
deleting a node, validate the exact Compose invocation before capture,
and repair updateStack return-contract fixtures.

* fix: resolve ESLint errors blocking CI on this branch

Unused-import and unused-variable errors left over from the stack
deletion refactor: MeshService in stacks.ts (its opt-out cascade moved
into DeployedStackDeletionService), a redundant pruneVolumes
destructure in deleteDeployedStack (the real one is re-derived from
the same input object inside runDeletionBody), and an unused beforeAll
import in a Docker-integration test stub. Also scopes the webhook
pull-action case body in a block to satisfy no-case-declarations;
purely syntactic, no behavior change.

* fix: harden recovery probe, cleanup retry, and failed-pull Docker test

Reject absent or unhealthy expected replicas before reporting rollback
success, keep cleanup records until artifacts are actually removed, fail
closed when a mesh override cannot be generated, and assert a real
failed pull leaves the original container running.

* fix: verify recovery probe image identity and stack-scoped override paths

Reject recovered runtimes that use the wrong image or leave scale-zero
services running, and confine tombstone override deletion to the intent
stack directory so forged cross-stack paths cannot be swept.

* test: batch notification cap fixtures in a SQLite transaction

Unbatched 1200-row inserts were timing out at the default 30s under
CI load even though the same assertions pass in under 2s when green.
2026-07-21 12:18:01 -04:00

32 lines
1.4 KiB
TypeScript

import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
environment: 'node',
// Only run TypeScript sources - exclude the compiled dist/ output.
include: ['src/__tests__/**/*.test.ts'],
exclude: ['dist/**', 'node_modules/**', 'src/__tests__/docker-integration/**'],
// Build the baseline DB (schema + migrations + admin seed) once; each
// test file's setupTestDb copies it instead of re-running migrations.
globalSetup: ['./src/__tests__/helpers/vitestGlobalSetup.ts'],
// Each test file gets its own worker so singletons are fresh between files.
pool: 'forks',
// Cap concurrency: each worker dynamic-imports the full Express stack
// (TypeScript transform + DB init + every migration), so an uncapped
// fork pool that scales with availableParallelism saturates CPU and
// the suite spends most of its wall time waiting on cold-start
// contention. Four parallel workers is a sweet spot on both CI
// runners and laptops.
maxWorkers: 4,
minWorkers: 1,
// Timeout generous for DB init and HTTP calls.
testTimeout: 30_000,
// Every test file dynamic-imports the full Express stack; each fork pays
// TypeScript transformation cost and can take tens of seconds under
// CPU contention.
hookTimeout: 45_000,
// Sequential within each file (DB state is shared per file).
sequence: { concurrent: false },
},
});