Add new reporter lifecycle method to trigger after coverage report

Open
#9,667 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript
Domain
testing-qa

Research direction

Start in packages/vitest/src/node/core.ts at lines 1380-1389, then read the reporter lifecycle definitions and the existing onFinishedReportCoverage usage referenced by the issue. Compare the timing of onTestRunEnd with coverage generation and the discussion in PR #9626. Done means Reporter exposes onCoverageReport and it is triggered after the coverage report is generated.

Written by the indexing model from the issue text.

Description

enhancement: pending triage p2-to-be-discussed
Clear and concise description of the problem

As brought up in https://github.com/vitest-dev/vitest/pull/9626#discussion_r2791185647, builtin HTML reporter and ui mode currently rely on special onFinishedReportCoverage method to wait for coverage html generation because currently available onTestRunEnd is too early.

https://github.com/vitest-dev/vitest/blob/86fad4b42603a5d1c4935b82656d2fd8d2d44bf1/packages/vitest/src/node/core.ts#L1380-L1389

Suggested solution

Add Reporter.onCoverageReport method which gets triggered after coverage report.

Alternative

No response

Additional context

No response

Validations
Dominant language
TypeScript
Stars
17.1k
Forks
2k
Avg merge
1d 21h
Merged PRs (30d)
92

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.

More from vitest-dev/vitest

All issues in vitest-dev/vitest

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.