Implements the test cases called out in the PR #119 review threads (code-review, test-strategy report, red-team) — TESTS ONLY, no production code changes. packages/git-sync (vitest): - lib converter/markdown gaps: pageBreak data-loss (it.fails repro), subpages lossy round-trip, nested/fenced callouts, ol->taskList bridge, column.width number<->string drift, empty details. - engine units: parentFolderFile, planReconciliation swap/chained move, buildVaultLayout last-resort-by-id, firstDivergence, applyPushActions / applyPullActions failure isolation. - real temp-git integration: diffNameStatus -z rename+add/modify alignment, copy-line behavior, per-invocation committer identity (no leak into repo/global config). - ENFORCED type-level GitSyncClient contract via vitest typecheck over a *.test-d.ts file (tsconfig.vitest.json; build tsconfig untouched). apps/server (jest): - orchestrator: delete-cap neutralization + fail-safe, Redis lock / mutex skip ladder + release-on-throw, merge guard, pull/push order, remote template substitution, poll lifecycle. - page-change listener: loop-guard, debounce coalescing, id resolution, error swallowing. - vault registry, controller authz (trigger + status), env validation/getters, page.service git-sync provenance stamping, persistence precedence (agent > git-sync > user) + no boundary snapshot, space.service audit-delta, space.repo jsonb-merge, converter-gate corpus extension (mention/math/details/marks). apps/client (vitest + testing-library): - history-item git-sync badge: render gating + non-clickable. - edit-space-form toggle: initial state, optimistic payload, rollback on error, disabled states. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
41 lines
1.8 KiB
TypeScript
41 lines
1.8 KiB
TypeScript
import { fileURLToPath } from 'node:url';
|
|
import path from 'node:path';
|
|
import { defineConfig } from 'vitest/config';
|
|
|
|
// Ported docmost-sync tests import the converter through the upstream package
|
|
// barrel specifier `docmost-client`. We vendored only the PURE half of that
|
|
// package into `src/lib`, so alias the barrel specifier to our local lib
|
|
// barrel; everything those tests use (converter, canonicalize, markdown
|
|
// envelope, markdownToProseMirror) is re-exported there.
|
|
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
const libBarrel = path.resolve(here, 'src/lib/index.ts');
|
|
|
|
export default defineConfig({
|
|
resolve: {
|
|
alias: {
|
|
'docmost-client': libBarrel,
|
|
},
|
|
},
|
|
test: {
|
|
environment: 'node',
|
|
// Runtime suites. The `.test.ts` glob deliberately EXCLUDES the type-only
|
|
// contract file (`*.test-d.ts`), which is enforced by the typecheck pass
|
|
// below instead — so the 35 runtime suites are never typechecked.
|
|
include: ['test/**/*.test.ts'],
|
|
// Type-level contract enforcement (Finding #1). Vitest runs `tsc` over the
|
|
// `.test-d.ts` files so the `expectTypeOf`/`@ts-expect-error` guards in
|
|
// git-sync-client.contract.test-d.ts become REAL build-time assertions: a
|
|
// drift in the GitSyncClient result shapes makes `npx vitest run` FAIL with
|
|
// a type error. Scoped to `*.test-d.ts` so the runtime suites stay
|
|
// untouched, and pointed at the package tsconfig for the strict options.
|
|
typecheck: {
|
|
enabled: true,
|
|
include: ['test/**/*.test-d.ts'],
|
|
// A dedicated test-infra tsconfig (NOT the build one) that widens the file
|
|
// set to include `test/**` — the build tsconfig scopes `tsc` to `src/**`
|
|
// (rootDir ./src), so without this the type-test file is never checked.
|
|
tsconfig: './tsconfig.vitest.json',
|
|
},
|
|
},
|
|
});
|