1a7b817250
F1 [critical, data-loss] — escape the image alt in ``. Canon #4 moved the top-level image off the lossless <img> form onto markdown ``, but the alt was inserted raw; the importer re-parses the `![alt]` label as CommonMark inline, so a markdown-active char in a realistic description ("Figure [1]", "the *new* logo", "a]b[c") broke the round-trip — the image node vanished or emphasis collapsed. Now `escapeLinkText(imgAttrs.alt ?? "")`, exactly as the link-form media (attachment/pdf/embed) already escape their visible text. Regression test added: six active-punctuation alts round-trip byte-stable with the node intact. F2 [drift] — re-export `clampCalloutType` / `sanitizeCssColor` from the package barrel and drop the verbatim copies in the mcp schema shim. The copies had already drifted (the mcp `clampCalloutType` lost the callout-type alias mapping the package applies), which is exactly the schema drift #293 exists to kill. The sanitizers now live only in the package; mcp `schema.test.mjs` exercises the single alias-aware implementation. F3 [docs] — AGENTS.md:296 said `packages/mcp/build/` is committed; this branch gitignored it (git-sync/prosemirror-markdown convention). Updated the line to say it is gitignored and rebuilt in CI/Docker via `pnpm build`. F4 [cleanup] — removed the dead `test.typecheck` block from the package vitest.config.ts and deleted tsconfig.vitest.json. Both were copied verbatim from git-sync; this package has zero `*.test-d.ts` files, and the ported comments referenced git-sync-only entities. Kept the `docmost-client` resolve alias (22 tests use it) and the runtime include/environment. package vitest: 658 passed (+1 F1 regression); tsc clean. git-sync: 268 passed. mcp: node --test 454 passed; tsc clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
24 lines
781 B
TypeScript
24 lines
781 B
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',
|
|
include: ['test/**/*.test.ts'],
|
|
},
|
|
});
|