@lxgicstudios/ai-test-gen
v1.0.1
Published
AI-powered unit test generator - create Jest, Vitest, and Mocha tests from source files using GPT
Maintainers
Readme
ai-test-gen
Point it at your source files and it writes unit tests for you. Supports Jest, Vitest, and Mocha.
Install
npm install -g ai-test-genSetup
export OPENAI_API_KEY=sk-your-key-hereUsage
# Generate Jest tests for a file
npx ai-test-gen src/utils.ts --framework jest
# Vitest instead
npx ai-test-gen src/utils.ts --framework vitest
# Multiple files
npx ai-test-gen "src/**/*.ts" --framework jest
# Save to a file
npx ai-test-gen src/utils.ts --framework jest -o src/__tests__/utils.test.tsWhat you get
Actual test files with imports, describe blocks, and test cases. It covers happy paths, edge cases, and error handling. You'll probably want to tweak them a bit, but it beats starting from scratch.
Heads up
The generated tests are a starting point. They won't know about your mocks, test utilities, or specific setup. But they'll get you 80% there, which is the annoying part anyway.
