convex-test

Generate vitest tests for Convex functions against an in-memory backend.

Updated Sep 17, 2026
One-click install
npx skills add https://github.com/Tehzeeb07/CodeRush --skill convex-test-tehzeeb07
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: convex-test
Source: https://github.com/Tehzeeb07/CodeRush/tree/main/.agents/skills/convex-test
Command: npx skills add https://github.com/Tehzeeb07/CodeRush --skill convex-test-tehzeeb07

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires convex-test, vitest.

What problem does it solve? Testing Convex backend functions against a live deployment is slow, flaky, and hard to make deterministic. This Skill guides the generation of convex-test based unit tests that run queries, mutations, and scheduled functions against an in-memory backend. ## Core Features & Use Cases - In-Memory Function Testing: Call t.query and t.mutation against a convexTest(schema) instance without a live deployment. - Auth and Error Coverage: Test authenticated paths with withIdentity and assert error paths, not just the happy path. - Scheduled Function Testing: Use t.finishInProgressScheduledFunctions to verify cron and scheduled logic deterministically. - Use Case: After writing a new Convex mutation that creates an order, generate vitest tests that seed data via t.run, call the mutation with and without identity, and assert both the return value and the permission-denied error. ## Quick Start Generate convex-test vitest tests for my Convex functions covering auth, error paths, and scheduled functions.

Frequently Asked Questions about convex-test

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test Convex functions without a live deployment?▼

Use the convex-test library with vitest to run functions against an in-memory backend. Create a test instance with convexTest(schema), seed data via t.run, then call t.query or t.mutation and assert the results.

How to test Convex mutations with authentication?▼

Call t.withIdentity to simulate an authenticated user before invoking the mutation. This lets you verify both authorized success paths and permission-denied error paths without configuring a real auth provider.

Can convex-test run scheduled functions and crons?▼

Yes, convex-test supports scheduled functions through t.finishInProgressScheduledFunctions, which completes pending scheduled work so you can assert its effects. Tests remain deterministic because no real timers or network calls are involved.

What should Convex function tests cover besides the happy path?▼

Cover authentication states, argument validation errors, and index or edge-case behavior in addition to successful returns. Testing only the happy path misses the failure modes most likely to break in production.

Why are my Convex tests flaky or non-deterministic?▼

Flakiness usually comes from relying on real time, network calls, or a live deployment. convex-test runs entirely in memory, so keep tests free of real clocks and external services to stay deterministic.