jestjs / jestjs/jest

Feature request: Get detailed metadata from expect matchers in reporters

Open
#4,547 8 comments 5 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
45.5k
Forks
6.7k
Avg merge
17h 22m
Merged PRs (30d)
24

Description

I'd like to generate HTML reports from [jest-image-snapshot](https://github.com/americanexpress/jest-image-snapshot) with the diff images.

But doing it from a customer Jest reporter does not seem to be possible because because custom matchers such as the `toMatchImageSnapshot` cannot pass extra metadata (path to the snapshot diff file) to the reporters.

I'd like to be able to return the filename [here](https://github.com/americanexpress/jest-image-snapshot/blob/928f69c7b183ffdb7eeb7fca8ba7172813fc1b2a/src/index.js#L57) and read it somehow in a `onTestResult()` method of a reporter.

Ref https://github.com/americanexpress/jest-image-snapshot/issues/13

Contributor guide

Open the contributing guide

Research direction

Start with the linked jest-image-snapshot src/index.js location and the Jest reporter onTestResult() entry point. Trace how toMatchImageSnapshot results reach custom reporters and determine how the diff filename could be exposed as matcher metadata. Done means a reporter can access that metadata when generating an HTML report, with coverage for the behavior identified during the investigation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.