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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More granular reporter API #4500

Closed
palmerj3 opened this issue Sep 18, 2017 · 2 comments
Closed

More granular reporter API #4500

palmerj3 opened this issue Sep 18, 2017 · 2 comments

Comments

@palmerj3
Copy link
Contributor

Do you want to request a feature or report a bug?

Feature

What is the current behavior?

A jest reporter can register 5 callbacks right now:
onRunStart - when the runner is first initiated
onTestStart - when a suite is first run
onTestResult - when a suite has completed
onRunComplete - when the runner has completed
getLastError

What is the expected behavior?

I would like some more granularity for the reporter API.
Specifically I would like callbacks for when an individual test is run and complete.

The jasmine API has specStarted and specDone for this purpose.
But right now the jest reporter API doesn't seem to provide the ability to have a callback before and after a given test is run - only callbacks for when the parent suite is run.

For example with the following test.spec.js file onTestStart is only called once even though there are two tests:

describe('describe block', () => {
  it('should pass', () => {
    expect(true).toEqual(true);
  });

  it('should fail', () => {
    expect(true).toEqual(false);
  });
})

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.

Jest: 21.1.0
OS: Mac OSX 10.12.6
Yarn: 0.27.5

@cpojer
Copy link
Member

cpojer commented Sep 18, 2017

@aaronabramov is working on it. #4471 etc. Please ask him there.

@github-actions
Copy link

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 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants