Loading...
Loading...
Clarity test infrastructure generation — scaffold vitest configs, test stubs, Clarunit files, and Rendezvous fuzz tests for Clarinet projects.
npx skill4agent add aibtcdev/skills clarity-test-scaffoldbun run clarity-test-scaffold/clarity-test-scaffold.ts <subcommand> [options]bun run clarity-test-scaffold/clarity-test-scaffold.ts scaffold --project-dir <path> [--include-clarunit] [--include-fuzz] [--dry-run]--project-dirClarinet.toml--include-clarunit.clar--include-fuzz--dry-run{
"projectDir": "/path/to/project",
"contracts": ["my-contract", "helper-contract"],
"filesGenerated": [
{"path": "vitest.config.js", "action": "created"},
{"path": "package.json", "action": "updated"},
{"path": "tsconfig.json", "action": "created"},
{"path": "tests/my-contract.test.ts", "action": "created"},
{"path": "tests/helper-contract.test.ts", "action": "created"}
],
"dependencies": {
"@hirosystems/clarinet-sdk": "^2.0.0",
"vitest": "^1.0.0",
"vitest-environment-clarinet": "^2.0.0"
},
"scripts": {
"test": "vitest run",
"test:watch": "vitest"
}
}bun run clarity-test-scaffold/clarity-test-scaffold.ts add-fuzz --project-dir <path> --contract <contract-name> [--dry-run]--project-dir--contract--dry-run{
"contract": "my-contract",
"filesGenerated": [
{"path": "contracts/my-contract.tests.clar", "action": "created"}
],
"dependencies": {
"@stacks/rendezvous": "^1.0.0"
},
"scripts": {
"test:rv": "npx rv . my-contract test",
"test:rv:invariant": "npx rv . my-contract invariant"
},
"publicFunctions": ["transfer", "set-value"],
"propertyTests": ["test-transfer", "test-set-value"],
"invariantTests": ["invariant-supply-capped"]
}bun run clarity-test-scaffold/clarity-test-scaffold.ts check --project-dir <path>--project-dir{
"projectDir": "/path/to/project",
"complete": false,
"contracts": ["my-contract", "helper-contract"],
"findings": [
{"type": "missing", "description": "No test file for helper-contract"},
{"type": "config", "description": "vitest.config.js missing singleThread: true"},
{"type": "dependency", "description": "@hirosystems/clarinet-sdk not in package.json"}
],
"coverage": {
"contractsWithTests": 1,
"contractsTotal": 2,
"percentage": 50
}
}import { defineConfig } from "vitest/config";
import { vitestSetupFilePath, getClarinetVitestsArgv } from "@hirosystems/clarinet-sdk/vitest";
export default defineConfig({
test: {
environment: "clarinet",
singleThread: true,
setupFiles: [vitestSetupFilePath],
environmentOptions: {
clarinet: getClarinetVitestsArgv(),
},
},
});beforeAllbeforeEachsingleThread: trueStxer (Historical Simulation) — Pre-mainnet validation
RV (Property-Based Fuzzing) — Invariants, edge cases
Vitest + Clarinet SDK — Integration tests (default)
Clarunit — Unit tests in ClarityClarinet.toml--dry-runclarity-patterns