convex-test

Generate convex-test and vitest tests for Convex backend functions.

9.4k|1.5k|Updated Jan 3, 2026
One-click install
npx skills add https://github.com/openclaw/clawhub --skill convex-test
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: convex-test
Source: https://github.com/openclaw/clawhub/tree/main/.agents/skills/convex-test
Command: npx skills add https://github.com/openclaw/clawhub --skill convex-test

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires convex-test, vitest.

What problem does it solve?

Writing tests for Convex backend functions often requires a live deployment, making tests slow, flaky, and hard to run in CI. This Skill guides the generation of deterministic, in-memory tests for queries, mutations, auth paths, and scheduled functions.

Core Features & Use Cases

  • In-Memory Testing: Uses convex-test with vitest to run functions against an in-memory backend instead of a live deployment.
  • Comprehensive Coverage: Covers argument validation, return values, auth flows via withIdentity, error paths, indexes, and scheduled functions via t.finishInProgressScheduledFunctions.
  • Deterministic Execution: Enforces tests with no real time or network dependencies so results are reproducible.
  • Use Case: After adding a new mutation to your Convex app, generate a vitest suite that seeds data with t.run, calls the mutation via t.mutation, and asserts both success and unauthorized-access behavior.

Quick Start

Generate convex-test tests for my Convex functions covering auth, error paths, and scheduled functions using vitest.

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 convex-test with vitest to run functions against an in-memory backend. Initialize with convexTest(schema), seed data via t.run, and invoke t.query or t.mutation to assert results without any network access.

How to test authentication in Convex functions?

Use the withIdentity method from convex-test to simulate authenticated users when calling queries or mutations. This lets you verify both authorized access paths and unauthorized error responses in your tests.

Can I test Convex scheduled functions with vitest?

Yes, convex-test supports scheduled functions through t.finishInProgressScheduledFunctions, which runs pending scheduled work to completion. This lets you assert the effects of cron jobs and scheduled mutations deterministically.

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 timers and external requests to ensure deterministic results.

What should Convex function tests cover beyond the happy path?

Cover authentication states, argument validation errors, and failure branches in addition to successful executions. Also verify index behavior and scheduled function outcomes to catch regressions in data access patterns.