Skip to content

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’s packageManager entry)

Install dependencies from the repo root:

bash
pnpm install

Scripts

CommandDescription
pnpm testRuns the Vitest suite with coverage (test/graph.test.ts).
pnpm test -- --runInBandSerial execution useful when debugging or logging extensively.
pnpm lintESLint with auto-fix enabled for src/.
pnpm buildProduces ESM, CJS, and IIFE bundles via Vite and regenerates declaration files.
pnpm docs:devLaunches VitePress for this docs/ folder.
pnpm docs:build / pnpm docs:previewBuild and preview the static documentation site.
pnpm releaseRuns tests, builds artifacts, and generates the changelog using changelogen.
  1. pnpm test --watch while iterating on algorithms or data structures.
  2. Update/add docs under docs/ whenever public APIs or behaviors change.
  3. Run pnpm build before publishing to confirm the bundler and declaration generator still succeed.
  4. Execute pnpm docs:build to ensure the docs site compiles (especially after adding new pages).

Coverage & debugging

  • Vitest stores coverage reports in coverage/; open coverage/index.html to inspect statements/branches.
  • Use vitest --logHeapUsage (already configured in pnpm 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).

Built with VitePress – Released under the MIT License.