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","coverage"], {});
console.log(JSON.stringify(result));From the command line
$ mark vitest coverage
As data, in a program
{ "$proc": ["vitest", "coverage"], "input": {} }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"
}
},
"threshold": {
"description": "The minimum line coverage in percent. Below it, the result has `success: false`.",
"type": "number"
}
}
},
"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": {}
}
}