vitest-dev / vitest-dev/vitest

Ability to customize the HTML report

Open
#9,798 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement: pending triage feat: reporters p2-to-be-discussed
Dominant language
TypeScript
Stars
17.1k
Forks
2k
Avg merge
1d 22h
Merged PRs (30d)
94

Description

Clear and concise description of the problem

Hi!

Thank you for building & maintaining vitest 🫶

I'd like to switch from Jest to Vitest,
but on our project we used this nice HTML reporter: https://github.com/Hazyzh/jest-html-reporters
It has a very handy feature: the customInfos field can be used to insert custom information to the final HTML report.

Vitest already has a nice builtin HTML reporter: https://vitest.dev/guide/reporters.html#html-reporter
There is even some nice documentation on the reporter API, to build your own: https://vitest.dev/api/advanced/reporters.html

However, could it be considered to provide way for @vitest/ui to provide some basic customization settings please?

Suggested solution

I'm thinking about allowing the end-user control over a <div> or <p> content on the HTML report page.
Ideally through a "hook" that could receive tests results statistics (e.g. number of OK / failed tests).

Is this something that could be considered for @vitest/ui, please?

Alternative

Maybe fork this repo and hack something into @vitest/ui, but that would be hell to maintain over years...

Additional context

No response

Validations

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the @vitest/ui package and read the HTML reporter and reporter API documentation linked in the issue. Determine the supported customization scope and how a hook could receive test-result statistics. Done means an agreed, documented customization interface is implemented and verified in the HTML report.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.