jest icon indicating copy to clipboard operation
jest copied to clipboard

[Feature]: report beginning of every `test` or `it` via reporter API

Open segrey opened this issue 3 years ago • 4 comments

🚀 Feature Proposal

Now Reporter API reports the result of every test or it, but there are no events for beginning of each test or it.

Related discussion in #6616

Motivation

Reporting the beginning of each test/it would allow external tools (like IDEs) to provide more fine-grained support for test trees. For example, it would allow to attach test output (e.g. produced by console.log) properly to test nodes. Right now all the output wrongly goes to an ancestor node corresponing to the test file containing test/it. In particular, it would allow to fix https://youtrack.jetbrains.com/issue/WEB-53839.

For example, here is how it looks when running with jest@28 the following test file

it('foo', function () {
    console.log('foo');
});
it('bar', function () {
    console.log('bar');
});

when foo or bar test nodes are selected, no output is shown: wrong2

Here is how it's expected to work (captured with jest@27 and "testRunner": "jasmine2"): right

Example

No response

Pitch

Looks like some changes in jest-circus and jest-reporter are needed.

segrey avatar Aug 10 '22 00:08 segrey

@SimenB What do you think?

segrey avatar Aug 10 '22 00:08 segrey

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

github-actions[bot] avatar Sep 09 '22 00:09 github-actions[bot]

Bad robot.

Ariane-B avatar Sep 09 '22 01:09 Ariane-B

Happy to take a PR adding this! 🙂

SimenB avatar Sep 09 '22 06:09 SimenB

Hey @SimenB,

I have made a pull request to implement this feature request. Could you please suggest who I should ask for a review?

Thanks 🙏

DmitryMakhnev avatar May 31 '23 17:05 DmitryMakhnev

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[bot] avatar Jul 21 '23 00:07 github-actions[bot]