Tests close to your code

Draft tests as your code changes.

Specwatch drafts JavaScript and TypeScript tests from source changes, then can run the generated file with Jest or Vitest. Ollama is the default model provider; cloud providers are optional. Review generated tests before relying on them.

What it does

One job. A handful of deliberate commands.

01

Watch mode

specwatch watch

Watches JavaScript and TypeScript source files, generates a nearby test file, and can run it through Jest or Vitest.

02

One-shot generation

specwatch gen src/

Draft tests for a file, directory, or glob using detected conventions. Preview with gen --dry-run; normal generation can overwrite an existing test file.

03

Maintenance

specwatch fix

Re-runs existing test files and regenerates failing files from source. Review replacements before keeping them.

04

Coverage

specwatch coverage

Reads an existing Istanbul coverage-final.json report and lists files below a statement threshold. JSON output is available.

05

Local first

specwatch.config.ts

All code analysis happens on your machine, with models you choose. Cloud providers are opt-in and per-project.

06

CI integration

specwatch ci --coverage

Runs existing test files and optionally checks an existing coverage report. Missing or invalid coverage reports fail the gate before test execution.

The shape of it

Build, watch, and check.

  1. 01

    Install

    npm install --save-dev ./specwatch-0.1.0.tgz

    Download the CLI archive below and install it in your JavaScript or TypeScript project with Jest or Vitest.

  2. 02

    Watch

    ./node_modules/.bin/specwatch watch

    On source changes, Specwatch asks the selected model for a test file and can run that file. Normal watch and generation may replace an existing sibling test file.

  3. 03

    Check

    ./node_modules/.bin/specwatch ci --coverage

    Run existing tests and check an existing Istanbul coverage report against a statement threshold. Missing or invalid measurements are setup errors; generate the report with your framework first.

Plays well with

VitestJestOllamaTypeScriptJavaScriptNode.js

Review your test drafts

A draft deserves a closer look.

Run Specwatch in your own project with Node.js, Jest or Vitest, and a model you choose. Local Ollama keeps model requests on your machine; optional cloud providers receive source context to draft tests.

Preview first

gen --dry-run previews a generated test. Normal gen, watch, and fix can replace an existing sibling test file.

Check the report

Generate coverage with your test framework first. ci --coverage checks the existing Istanbul report and refuses missing or invalid measurements. Review assertion quality as well as coverage.

Start in your project

Draft, review, then run.

Use Node.js 22.12 or newer and your existing Jest or Vitest project. Test generation needs a running Ollama model or a configured cloud provider.

npm install --save-dev ./specwatch-0.1.0.tgz
./node_modules/.bin/specwatch --help
./node_modules/.bin/specwatch gen src/example.ts --dry-run
./node_modules/.bin/specwatch ci --coverage --json

Run commands from your project folder. Generate an Istanbul coverage-final.json before using the coverage gate. Preview with --dry-run; normal generation, watch and repair can replace sibling test files. Keep existing tests in version control and review each generated change.