Development & Testing Workflow
Follow this checklist to work on @avensio/graph, validate changes, and keep the documentation in sync.
Requirements
- Node.js 20+
- pnpm 10+ (see
package.json’spackageManagerentry)
Install dependencies from the repo root:
bash
pnpm installScripts
| Command | Description |
|---|---|
pnpm test | Runs the Vitest suite with coverage (test/graph.test.ts). |
pnpm test -- --runInBand | Serial execution useful when debugging or logging extensively. |
pnpm lint | ESLint with auto-fix enabled for src/. |
pnpm build | Produces ESM, CJS, and IIFE bundles via Vite and regenerates declaration files. |
pnpm docs:dev | Launches VitePress for this docs/ folder. |
pnpm docs:build / pnpm docs:preview | Build and preview the static documentation site. |
pnpm release | Runs tests, builds artifacts, and generates the changelog using changelogen. |
Recommended flow
pnpm test --watchwhile iterating on algorithms or data structures.- Update/add docs under
docs/whenever public APIs or behaviors change. - Run
pnpm buildbefore publishing to confirm the bundler and declaration generator still succeed. - Execute
pnpm docs:buildto ensure the docs site compiles (especially after adding new pages).
Coverage & debugging
- Vitest stores coverage reports in
coverage/; opencoverage/index.htmlto inspect statements/branches. - Use
vitest --logHeapUsage(already configured inpnpm dev) when investigating memory hotspots on large graphs.
Contributing guidelines
- Keep README snippets aligned with the docs landing page to avoid drift.
- Prefer adding new fixtures under
test/factories/if you need bespoke graph topologies for reproducible tests. - When introducing new serialization formats or events, extend the appropriate doc (e.g.,
serialization.md,events.md).