feat(standalone): sexprDiff structural comparator + vitest (0003/0004 §B)
Add the shared, uuid-keyed structural s-expr comparator (README §B) used by both
the live drift check (0003) and the round-trip tests (0004), plus a vitest setup.
- wasm/collab/sexpr-diff.ts: zero-dependency module (importable from standalone
app code and the Playwright specs). Tokenizes s-expr text into nested lists,
indexes item nodes by their direct (uuid "X") child, compares item sets order-
insensitively as multisets of normalized children, emitting
{ equal, added, removed, changed } with per-property a/b. ignoreTokens drops
volatile tokens. False-positive-free only for same-serializer inputs.
- wasm/collab/sexpr-diff.test.ts: 15 cases (parse, equality, changes, ignoreTokens).
- vitest config + test scripts (node env, isolated from the app build).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 18:06:06 +02:00
|
|
|
import path from "node:path";
|
|
|
|
|
import { defineConfig } from "vitest/config";
|
|
|
|
|
|
|
|
|
|
// Standalone unit-test config, intentionally separate from vite.config.ts so the
|
|
|
|
|
// test run doesn't pull in the React plugin / WASM-asset dev server. Pure-logic
|
|
|
|
|
// modules (e.g. the sexpr-diff comparator) run in the node environment.
|
|
|
|
|
export default defineConfig({
|
|
|
|
|
resolve: {
|
|
|
|
|
alias: { "@": path.resolve(__dirname, "./src") },
|
2026-06-30 09:30:15 +02:00
|
|
|
// @pcbjam/shared lives in a second pnpm workspace, so without this its `yjs`
|
|
|
|
|
// and the standalone's `yjs` resolve to two physical copies → a Y.Map from
|
|
|
|
|
// one instance rejects Y types from the other ("Unexpected content type").
|
|
|
|
|
// Force a single yjs (it's a shared mutable singleton — instanceof-checked).
|
|
|
|
|
dedupe: ["yjs"],
|
feat(standalone): sexprDiff structural comparator + vitest (0003/0004 §B)
Add the shared, uuid-keyed structural s-expr comparator (README §B) used by both
the live drift check (0003) and the round-trip tests (0004), plus a vitest setup.
- wasm/collab/sexpr-diff.ts: zero-dependency module (importable from standalone
app code and the Playwright specs). Tokenizes s-expr text into nested lists,
indexes item nodes by their direct (uuid "X") child, compares item sets order-
insensitively as multisets of normalized children, emitting
{ equal, added, removed, changed } with per-property a/b. ignoreTokens drops
volatile tokens. False-positive-free only for same-serializer inputs.
- wasm/collab/sexpr-diff.test.ts: 15 cases (parse, equality, changes, ignoreTokens).
- vitest config + test scripts (node env, isolated from the app build).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 18:06:06 +02:00
|
|
|
},
|
|
|
|
|
test: {
|
|
|
|
|
environment: "node",
|
|
|
|
|
include: ["src/**/*.test.ts"],
|
|
|
|
|
},
|
|
|
|
|
});
|