vitest-tiny-reporter
is a minimal reporter for Vitest that provides the most essential information about the test run. This is very useful with tools like lefthook that run several checks in parallel, where you want to see the test results without scrolling through a lot of output.
npm install --save vitest-tiny-reporter
You can specify the reporter in your vitest.config.ts
:
import type { UserConfig } from 'vitest/config';
import TinyReporter from 'vite-tiny-reporter';
export default {
test: {
reporters: [new TinyReporter()],
},
} satisfies UserConfig;
Or you can use the reporter from the command line:
vitest --reporter vitest-tiny-reporter
Or with lefthook:
pre-commit:
parallel: true
commands:
test:
glob: "*.ts"
run: npx vitest related --reporter=vitest-tiny-reporter --run {staged_files}
fail_text: "Tests failed"
env:
TERM: dumb
In a shell, the output will look like this:
$ vitest
✖ FAIL 1 test failed
Test Files 1 failed (1)
Tests 1 failed | 10 passed (11)
When used with lefthook and committing in the VSCode UI, vitest-tiny-reporter
shows actual usefull information.
Default reporter:
Tiny reporter: