Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Proposal] Provide API to added opaque data from test runs to reporter #10175

Closed
Bnaya opened this issue Jun 18, 2020 · 3 comments
Closed

Comments

@Bnaya
Copy link

Bnaya commented Jun 18, 2020

馃殌 Feature Proposal

Add api in the test runner side, that will push data into the returned TestResult, and make it available in the reporter's TestResult under "opaqueData" or so.
The data must be serializable

Motivation

We are working on a tool that collects various metadata on tests runs
Such as, screenshots or browser pages involved, logs, and additional metadata.
We need this data to be available for us in the reporter.

What we do now is, we save the data on disk, on path that is based on test describes and __filename,
It's working but have many limitations

See also discussion here
#10059 (comment)

Example

I'm not sure how's the api should look like from the test side
Adding a global function? or adding something to jest/globals?

But maybe:

import { addTestReporterData } from "@jest/globals";

beforeEach(async () => {
   const screenshot = async  page.screenshot();
   addTestReporterData("screenshot", screenshot);
});

Reporter side:

  onTestResult(
    test: Test,
    testResult: TestResult,
    aggregatedResults: AggregatedResult,
  ): void {
   makeNiceHtmlWithScreenshot(testResult.opaqueData.screenshot)
 }
@Bnaya Bnaya changed the title [Feature Proposal] Add api to added opaque data from test runs to reporter [Feature Proposal] Provide API to added opaque data from test runs to reporter Jun 18, 2020
@github-actions
Copy link

This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the Stale label Feb 25, 2022
@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

@github-actions
Copy link

github-actions bot commented May 5, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant