@devant-net/vitest-reporter
v0.4.0
Published
Vitest custom reporter that streams runs, results, and coverage into Devant.
Maintainers
Readme
@devant-net/vitest-reporter
Vitest custom reporter that streams test runs into Devant.
Install
npm i -D @devant-net/vitest-reporter
# or
bun add -d @devant-net/vitest-reporterConfigure
Set the connection in env or in vitest.config.ts:
// vitest.config.ts
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
reporters: [
"default",
["@devant-net/vitest-reporter", {
apiUrl: "https://<tenant>.devant.net",
apiToken: process.env.DEVANT_TOKEN,
projectId: 7,
}],
],
coverage: { reporter: ["v8"] }, // optional — surfaces in Devant
},
});Or pure env:
DEVANT_API_URL=https://<tenant>.devant.net \
DEVANT_TOKEN=dc_... \
DEVANT_PROJECT_ID=7 \
vitest runWhat gets reported
| Vitest event | Devant action |
| ------------------ | ------------------------------------------------------------ |
| onTestRunStart | POST /v1/runs — create the run, capture CI metadata |
| onTestCaseResult | POST /v1/runs/:id/results — per-test attempt, retries |
| onCoverage | POST /v1/runs/:id/coverage — v8 / istanbul summary |
| onTestRunEnd | POST /v1/runs/:id/complete — stamp finished_at |
Snapshot mismatches surface the diff text in error_message. Retries
land as separate test_result_attempt rows under the same test.
Test-case identity
When a result arrives, the reporter resolves it to a test_case in
this order:
@DEF-AB12style tag on the test (test("logs in @DEF-AB12", …))- Exact
fullNamematch in the project - Auto-create a new
test_case(the reporter prints a@KEYhint you can paste back into source to lock the binding)
Orchestrated runs
If DEVANT_RUN_ID is set, the reporter attaches to that existing run
instead of creating its own. The orchestrator owns createRun /
completeRun; this reporter only streams results.
License
See LICENSE.
