Skip to content

Add unit test suite (vitest) #1

@TheStack-ai

Description

@TheStack-ai

Context

pulser currently has zero tests. No test runner, no test files, no test framework in devDependencies. This is the single most impactful contribution you can make.

What to do

  1. Install vitest as a devDependency
  2. Add "test": "vitest run" to package.json scripts
  3. Write initial tests for:
    • src/eval/assertions.ts — 5 assertion types (contains, not-contains, min-length, max-length, matches), all pure functions
    • src/classifier.ts — skill type classification logic, pure scoring

Why these files first

Both are pure functions with clear inputs and outputs — no filesystem access, no side effects. Perfect for a first test suite.

Example

import { checkAssertion } from './assertions';

test('contains assertion passes when text includes substring', () => {
  expect(checkAssertion({ contains: 'hello' }, 'hello world')).toBe(true);
});

test('min-length assertion fails for short text', () => {
  expect(checkAssertion({ 'min-length': 50 }, 'short')).toBe(false);
});

Files to modify

  • package.json (add vitest, test script)
  • New: src/eval/assertions.test.ts
  • New: src/classifier.test.ts

Difficulty: Easy

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions