npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vitest-md-reporter

v0.3.1

Published

A Vitest reporter that generates Markdown test reports - ideal for CI pipelines, GitHub Actions job summaries, and AI agents fixing failing tests.

Readme

vitest-md-reporter

npm version License

A Vitest reporter that generates a Markdown test report file from your test run.

vitest-md-reporter turns Vitest results into a single readable Markdown file - grouped by project and test file, with passed/failed/skipped counts per module, suite, and test, plus run timing. Perfect for CI pipelines, GitHub job summaries, PR descriptions, and AI coding agents that read test results to fix failing tests.

Features

  • ✅ Generates Markdown reports from Vitest test runs
  • 📁 Groups tests by project and file
  • ⏱️ Shows metadata like start and end time or total duration of the test run
  • ⚡ Simple setup, fully ESM and TypeScript ready

Quick Start

1. Install

npm i -D vitest-md-reporter

Peer dependency: Vitest should already be installed in your project. If it is not, you probably do not need this package.

2. Configure Vitest

Minimal setup - just add the reporter:

// {vite,vitest}.config.{js,ts}
import { defineConfig } from 'vitest/config';
import { MarkdownReporter } from 'vitest-md-reporter';

export default defineConfig({
  test: {
    reporters: ['default', new MarkdownReporter()],
  },
});

Then run npx vitest run. The report is written to vitest-report.md.

Configuration options

All options are optional:

| Option | Required | Default | Description | | -------------------------- | -------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | outputFile | false | vitest-report.md | Path and filename for the generated Markdown report. Can be relative to the project root or an absolute path, but the file must remain within the project root. Attempts to save outside the project root will throw an error. | | projectLabel | false | Project | Label used as the section name for grouping test results by project. Useful when working with multiple Vitest projects | | projectsOrder | false | - | Explicit order in which projects should appear in the report. Projects not listed will be appended after the specified ones, preserving vitest order | | title | false | Vitest Test Report | Title displayed at the top of the report. Can be customized to match codebase or CI context | | style | false | default | Visual style of the report. Use compact for a token-efficient plain-text layout optimized for AI agents: no emojis, ISO timestamps, failing tests listed first | | writeToGitHubStepSummary | false | false | When running in GitHub Actions, append the rendered report to the job summary ($GITHUB_STEP_SUMMARY). No effect outside GitHub Actions | | outputJsonFile | false | - | Path for an optional machine-readable JSON companion report with the same structured data used to render the Markdown report. Must stay inside the project root, just like outputFile |

Example

// {vite,vitest}.config.{js,ts}
import { defineConfig } from 'vitest/config';
import { MarkdownReporter } from 'vitest-md-reporter';

export default defineConfig({
  test: {
    reporters: [
      'default',
      new MarkdownReporter({
        outputFile: './test-results/report.md',
        projectLabel: 'Test Level',
        projectsOrder: ['Unit', 'Integration'],
        title: 'Test Summary - MyApp',
      }),
    ],
  },
});

Environment variables

| Variable | Required | Default | Description | | -------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | REPORT_OUTPUT_ROOT | false | - | Defines the root directory where the reporter is allowed to write output files. All generated report files must resolve inside this directory. If not set, the current working directory (process.cwd()) is used. The reporter prevents writing files outside of this directory to avoid accidental or unsafe filesystem access (e.g. path traversal). This is mainly intended for CI environments where test artifacts are written outside of the project checkout directory. |

3. Run Tests

npx vitest run

The markdown report will be generated at the configured path (outputFile).

Example Output

# Vitest Test Report

## Test Run Summary

| ℹ️ Status | 🕒 Start Time          | 🕓 End Time            | ⌛ Duration |
| --------- | ---------------------- | ---------------------- | ----------: |
| ❌ failed | 26/01/2026 at 20:03:53 | 26/01/2026 at 20:03:53 |       300ms |

|            | ✅ Passed | ❌ Failed | ⏭️ Skipped | #️⃣ Total |
| ---------- | --------: | --------: | ---------: | -------: |
| Test Files |         0 |         1 |          0 |        1 |
| Tests      |         1 |         1 |          0 |        2 |

## Test Results

### Project: Renderer

| ✅ Passed | ❌ Failed | ⏭️ Skipped | #️⃣ Total | ⌛ Duration |
| --------: | --------: | ---------: | -------: | ----------: |
|         1 |         1 |          0 |        2 |       300ms |

#### ✅ test/renderer/MarkdownRenderer.test.ts

1 passed, 1 failed, 0 skipped, 2 total, done in 300ms

- ✅ renders title heading _100ms_
- 🗂️ rendering test run summary
  - ❌ renders test run summary heading _200ms_

AI & Agent Workflows

The report is a plain Markdown file - exactly what LLM-based tools read best. Common patterns:

Let a coding agent fix failing tests. Point your agent (Claude Code, Cursor, Copilot Workspace) at the report instead of re-running tests:

claude "Read vitest-report.md and fix every failing test."

Because the whole run is summarized in one compact file, the agent gets full context - which tests failed, where, and how long the run took - without parsing terminal output.

Use style: 'compact' for LLM context windows. The compact style strips emojis (each one costs multiple tokens), uses stable ISO timestamps, lists failing tests first, and includes captured error messages per failed test - so agents can diagnose failures without running anything:

new MarkdownReporter({
  style: 'compact',
  outputFile: 'vitest-report.md',
});
#### FAIL test/renderer/MarkdownRenderer.test.ts

1 passed, 1 failed, 0 skipped, 2 total, done in 300ms

- [suite] rendering test run summary
  - FAIL renders test run summary heading _200ms_

##### Failures

FAIL renders test run summary heading

```
AssertionError: expected 'Foo' to be 'Bar'
```

Publish it in CI. Set writeToGitHubStepSummary: true to render the report on the GitHub Actions run summary page, or upload it as an artifact so humans or bots can fetch a stable summary of any run - see examples/github-actions.yml.

Consume it programmatically. Set outputJsonFile to also write the structured test-run data as JSON for scripts and agents that prefer parsing over reading Markdown.

FAQ

How do I show the Markdown report in GitHub Actions? Set writeToGitHubStepSummary: true on the reporter, or append manually: cat vitest-report.md >> "$GITHUB_STEP_SUMMARY". See examples/github-actions.yml.

How do I change where the report is saved? Set new MarkdownReporter({ outputFile: './reports/test-results.md' }). Paths must stay inside the project root unless you set REPORT_OUTPUT_ROOT.

Can an AI agent read the test report? Yes - that is a core use case. The report is plain Markdown with a predictable structure (run summary → projects → modules → suites → tests), failed tests include their error messages, and style: 'compact' minimizes token usage. Use outputJsonFile if your tooling prefers structured JSON.

Does it work with Vitest projects / monorepos? Yes. Results are grouped per project, and projectsOrder controls the section ordering. Use projectLabel to rename the grouping heading.

License

MIT © Robert Kłódka