- Add test:coverage script and @vitest/coverage-v8 dev dependency - Update vitest.config.ts with @/ path alias and v8 coverage config - Create test/fixtures/graphs.ts with 5 fixture graphs (linearChain, diamond, mixedCategory, cyclic, largeGraph) and createTaskGraph helper - Expand graph.test.ts with 26 fixture validation tests - 30 tests passing, CI-compatible output (vitest run)
2.7 KiB
2.7 KiB
id, name, status, depends_on, scope, risk, impact, level
| id | name | status | depends_on | scope | risk | impact | level | |
|---|---|---|---|---|---|---|---|---|
| setup/test-infrastructure | Configure test runner and shared test fixtures | completed |
|
narrow | low | project | implementation |
Description
Set up the test infrastructure: configure Vitest (or chosen runner), create shared test fixtures and helpers for graph construction that all downstream test files will use. This avoids every test file building graphs from scratch.
Acceptance Criteria
- Test runner configured in
package.jsonscripts ("test","test:watch","test:coverage") - Vitest config (or equivalent) exists with ESM support and TypeScript path resolution
- Shared test fixture file created (e.g.,
test/fixtures/graphs.ts) with:- A simple linear chain graph (3-4 tasks, A→B→C→D)
- A diamond dependency graph (A→B, A→C, B→D, C→D)
- A graph with mixed categorical fields (some assessed, some null)
- A graph with cycles for testing cycle detection
- A larger graph (20+ nodes) for performance/bottleneck testing
- Helper function to create a
TaskGraphfromTaskInput[]for one-liner test setup - Test runner executes successfully against placeholder test files
- CI-compatible output format (no watch mode in default script)
References
- docs/architecture/build-distribution.md — test directory structure
- docs/architecture/graph-model.md — graph construction examples for fixtures
Notes
- Added
@vitest/coverage-v8@^3.2.4as a dev dependency to supportnpm run test:coverage createTaskGraph()builds a graphologyDirectedGraphdirectly usinggraph.import()(bulk construction per architecture recommendation) with deterministic edge keys (source->target) and defaultqualityRetention: 0.9- The
@/path alias resolves tosrc/for convenient test imports of source modules - Cycle detection uses
hasCycle()fromgraphology-dag(standalone function, not a method on the graph instance) - All fixture types (
TaskInput,TaskGraphNodeAttributes, etc.) are defined inline until the schema module is implemented
Summary
Configured Vitest test infrastructure and created shared test fixtures for graph construction.
- Modified: package.json (added
test:coveragescript,@vitest/coverage-v8dev dependency) - Modified: vitest.config.ts (added
@/path alias,includepattern, coverage config with v8 provider) - Modified: test/graph.test.ts (expanded with 26 fixture validation tests)
- Created: test/fixtures/graphs.ts (shared fixtures: linearChain, diamond, mixedCategory, cyclic, largeGraph + createTaskGraph helper + allGraphs/allTasks convenience exports)
- Tests: 30, all passing (5 placeholder + 25 fixture validation + 1 retained placeholder)