cflare ai test

AI Automated Test Synthesis

Llama 3.3 70B

Synthesize comprehensive unit, integration, and edge mock test suites using Llama 3.3 70B Instruct.

$ cflare ai test <inputOrFile> [options]

📖 Full Explanation

Ensuring zero regressions on serverless architectures requires rigorous test coverage. \1 parses your Worker script, API client, or utility function and generates modern tests covering edge cases, network timeouts, invalid payloads, and mocked Cloudflare bindings (\1, \1).

⚙️ Command Options & Flags

Option / Flag Description Default
-o, --output <file> Save generated test suite directly to file -
-f, --framework <name> Test framework: node:test, vitest, jest, mocha node:test
-m, --model <id> Override test generation model @cf/meta/llama-3.3-70b-instruct-fp8-fast

🔬 Technical Corollary & Edge Mechanics

The model uses \1 running on high-throughput FP8 tensor cores. It reads source code, constructs mocks matching Cloudflare's \1 or native Web Standards (\1, \1, \1), and formats tests using Node.js native \1 runner by default for zero extra npm dependencies.

🎯 Real-World DevOps Use Cases

Zero-Dependency Test Generation

Create a full test suite for a microservice using Node's built-in test runner.

$ cflare ai test src/auth.js -f node:test -o test/auth.test.js

Mocking Cloudflare Workers KV & R2

Generate integration tests that mock KV get/put and R2 stream writes.

$ cflare ai test worker.js -f vitest -o test/worker.spec.ts

💻 Live Output Simulation

$ cflare ai test src/api.js -o test/api.test.js
✔ Synthesized 8 unit tests across 4 test suites with Llama 3.3 70B (2,100ms)
✔ Written to test/api.test.js

Run with: node --test test/api.test.js