vitest.run
Run vitest tests once (no shell; uses the project's own vitest)
MCPCLI- Package
- @procedures/vitest · README
- Path
["vitest","run"]- CLI
mark vitest run- MCP tool
vitest.runon thedev-toolsserver- As data
{"$proc":["vitest","run"],"input":{}}
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/vitest"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["vitest","run"], {});
console.log(JSON.stringify(result));From the command line
$ mark vitest run
As data, in a program
{ "$proc": ["vitest", "run"], "input": {} }Input
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
cwd | string | no | The folder of the project (default: the current folder) | |
include | string[] | no | Test files or patterns to run (default: all tests) | |
exclude | string[] | no | Test files or patterns to leave out | |
watch | boolean | no | Run in watch mode (use vitest.watch for a long-running watcher) | |
coverage | boolean | no | Measure the coverage and give the percentages | |
reporter | "default" | "verbose" | "json" | "junit" | no | The vitest reporter | |
passWithNoTests | boolean | no | Succeed when no test file matches |
Output
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
success | boolean | yes | True when vitest ended with exit code 0 (and, for vitest.coverage, the threshold is met) | |
passed | number | yes | The number of tests that passed | |
failed | number | yes | The number of tests that failed | |
skipped | number | yes | The number of tests that were skipped | |
duration | number | yes | The time of the run, in milliseconds | |
exitCode | number | yes | The exit code of vitest (-1 when a signal ended it) | |
stdout | string | yes | The last 64 KiB of the output | |
stderr | string | yes | The last 64 KiB of the error output | |
coverage | object | no | The coverage percentages, when the run measured coverage |
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"cwd": {
"description": "The folder of the project (default: the current folder)",
"type": "string"
},
"include": {
"description": "Test files or patterns to run (default: all tests)",
"type": "array",
"items": {
"type": "string"
}
},
"exclude": {
"description": "Test files or patterns to leave out",
"type": "array",
"items": {
"type": "string"
}
},
"watch": {
"description": "Run in watch mode (use vitest.watch for a long-running watcher)",
"type": "boolean"
},
"coverage": {
"description": "Measure the coverage and give the percentages",
"type": "boolean"
},
"reporter": {
"description": "The vitest reporter",
"type": "string",
"enum": [
"default",
"verbose",
"json",
"junit"
]
},
"passWithNoTests": {
"description": "Succeed when no test file matches",
"type": "boolean"
}
}
},
"output": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "True when vitest ended with exit code 0 (and, for vitest.coverage, the threshold is met)"
},
"passed": {
"type": "number",
"description": "The number of tests that passed"
},
"failed": {
"type": "number",
"description": "The number of tests that failed"
},
"skipped": {
"type": "number",
"description": "The number of tests that were skipped"
},
"duration": {
"type": "number",
"description": "The time of the run, in milliseconds"
},
"exitCode": {
"type": "number",
"description": "The exit code of vitest (-1 when a signal ended it)"
},
"stdout": {
"type": "string",
"description": "The last 64 KiB of the output"
},
"stderr": {
"type": "string",
"description": "The last 64 KiB of the error output"
},
"coverage": {
"description": "The coverage percentages, when the run measured coverage",
"type": "object",
"properties": {
"lines": {
"type": "number",
"description": "The line coverage, in percent"
},
"branches": {
"type": "number",
"description": "The branch coverage, in percent"
},
"functions": {
"type": "number",
"description": "The function coverage, in percent"
},
"statements": {
"type": "number",
"description": "The statement coverage, in percent"
}
},
"required": [
"lines",
"branches",
"functions",
"statements"
],
"additionalProperties": {}
}
},
"required": [
"success",
"passed",
"failed",
"skipped",
"duration",
"exitCode",
"stdout",
"stderr"
],
"additionalProperties": {}
}
}