Testing Workflow

VSeed follows a strict test-driven development workflow. All test commands must be run from the project root directory.

Test Categories

1. Unit Tests

  • Goal: Test individual utility functions and Pipeline node logic.
  • Location: packages/vseed/tests/unit
  • Run:
    pnpm --filter=@visactor/vseed run test:unit

2. Integration Tests

  • Goal: Test the complete chart generation flow (VSeed Spec → VChart Spec).
  • Mechanism: Data-driven. Automatically generates test cases by reading JSON files under packages/vseed/tests/integrations and compares snapshots.
  • Run:
    pnpm --filter=@visactor/vseed run test:integration

Core Workflow

Step 1: Run Tests

Run relevant tests frequently during development to verify logic.

# Run all tests
pnpm --filter=@visactor/vseed run test

Step 2: Handle Snapshot Changes

If your code changes cause the output Spec to change (e.g., fixing a bug or adding a feature):

  1. Check the diff in the console output and confirm if the changes are expected.
  2. If expected, run the update command:
    pnpm --filter=@visactor/vseed run test:update

Step 3: Coverage Check

Before committing, it's recommended to check test coverage.

pnpm --filter=@visactor/vseed run test:coverage

Notes

  • Auto-generated: Integration test .test.ts files are generated by the g script — do not edit manually.
  • Adding test cases: To add integration tests, simply add a new JSON config file to the appropriate category directory under packages/vseed/tests/integrations, then run pnpm run g.