@kwitsch/vitest-plugin-claude-code-mod weekly downloads statistics
Vitest plugin that tests Claude Code mods with the claude-code/testing API.
@kwitsch/vitest-plugin-claude-code-mod has 8,493 recorded weekly downloads on npm, ranking #1337 of 3,247 tracked listings.
About @kwitsch/vitest-plugin-claude-code-mod
@kwitsch/vitest-plugin-claude-code-mod
Vitest plugin that runs Claude Code mod tests written for claude plugin test under plain Vitest, without the claude binary.
Installation
pnpm add -D @kwitsch/vitest-plugin-claude-code-mod vitest
Requires Node 26 or newer, Vitest ^5.0.0 and Vite 6.4 or newer.
Usage
Add the plugin to the Vitest config and point it at the mod's register module:
// vitest.config.ts
import claudeCodeMod from "@kwitsch/vitest-plugin-claude-code-mod";
import { defineConfig } from "vitest/config";
export default defineConfig({
plugins: [claudeCodeMod({ mod: "./src/hooks/register.ts" })],
});
Tests import the kit from claude-code/testing, exactly as under claude plugin test:
import { expect, mock, test } from "claude-code/testing";
test("a command reads an environment variable", async ($, on) => {
mock.env(on, { GREETING: "hello" });
expect(await $.command.run({ command: "env", args: "GREETING" })).toEqual({
text: "hello",
});
});
The plugin name is the name in package.json (without the npm scope). The options every register(on, options) gets start from the default of each entry under the top-level userConfig key of package.json:
{
"name": "my-mod",
"userConfig": { "greeting": { "type": "string", "default": "hello" } }
}
Projects that declare userConfig through the manifest option of the Rolldown plugin or the tsdown preset pass the entries through claudeCodeMod({ declared }) (the same shape as the userConfig entries of package.json) and, if they want to override a default, the values through claudeCodeMod({ userConfig }). declared is merged over the package.json entries per key, and its default values start the options. A test's own options are merged over them.
The options a mod would get are checked against the userConfig entries that package.json and the declared option declare (type, min, max, required), and a mismatch fails the test with Claude Code's text, for example options do not fit plugin.json userConfig: Limit must be a number.
For type checking, map claude-code/testing to the kit's types when no generated /plugin-types declaration covers it:
{
"compilerOptions": {
"paths": {
"claude-code/testing": [
"./node_modules/@kwitsch/vitest-plugin-claude-code-mod/dist/testing.d.mts"
]
}
}
}
Options
| Option | Default | Meaning |
|---|---|---|
mod | required | The mod's register module, relative to the Vite root or absolute. An array loads several modules in order, as one plugin. |
declared | package.json entries | The userConfig entries of a project that declares them elsewhere, such as the manifest option; merged over the package.json entries per key, checked against a test's options, and their default values start the options. Must be JSON-serializable. |
userConfig | userConfig defaults | The options handed to register, merged shallowly over the package.json defaults. Must be JSON-serializable. |
alias | true | Map the claude-code/testing import to this package's kit. |
strictSandbox | true | Check the mod's modules against the Claude Code mod sandbox and fail the test that loads a violating module. false, or false for a single rule ({ timers: false }; the rules are imports, computedImport, globals, timers and size), only warns. See Sandbox check. |
portable | false | Warns, with file and line, when a test calls an expect matcher that is not among the eight the official kit documents, and when an inline plugin's register uses a variable of the test file; "error" fails the test instead. The default false reports nothing. See Portable mode. |
Invalid options and an unreadable package.json, a missing name or a missing mod file stop Vitest with a claudeCodeMod: error before any test runs.
Sandbox check
Before Vitest runs a module of the mod, the plugin checks its source against what Claude Code's mod sandbox provides. Checked are the mod modules and every module they reach by relative imports, including a module a test file imported first. Test files and the kit are not checked. The code of bundled npm dependencies is not checked in tests either: the build-time check catches their imports and globals, but not timers.…
Description from the npm listing.
- claude-code
- claude-code-plugin
- claude-code-mod
- vitest
- vitest-plugin
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (121)Similar npm Testing plugins
All 20 @kwitsch/vitest-plugin-claude-code-mod alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/@kwitsch/vitest-plugin-claude-code-mod. First seen Nov 30, 2026; last successful collection Dec 6, 2026. See the methodology.