Files
gitmost/packages/git-sync/vitest.config.ts
T
claude code agent 227 24b903aaf3 build(git-sync): land the @docmost/git-sync package into develop, code-only (#326 step 1 / PR-A)
The git-sync converter + engine source lived only on the #119 branch; develop
had just the dead compiled build/. Bring the whole package (src + ~700 tests)
onto develop under CI, with NO consumer wired — git-sync stays fully inert in
develop (nothing in apps/server imports it), so runtime behavior is unchanged.
This unblocks #293 (extract the shared converter package from the landed source)
and lets #119's functionality land LAST, already writing the canonical format
(per the #326 landing order).

- packages/git-sync: src (lib converter + engine) + test corpus + configs.
- Remove develop's dead committed packages/git-sync/build/; gitignore it
  (built in CI/Docker via pnpm build, never committed — no src/build drift).
- pnpm-lock.yaml: add the @docmost/git-sync importer (a missing workspace
  package in the lock is a CI blocker). `pnpm install --frozen-lockfile` passes.
- NO server integration / loader / Dockerfile runtime changes (those come with
  #119 at step 6).

Verified: tsc clean; vitest 711 passed | 1 expected-fail, 0 failures, 0 type
errors; pnpm --frozen-lockfile EXIT 0; apps/server has no git-sync import.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-04 06:21:41 +03:00

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',
},
},
});