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

feat: report Individual Test Cases #10227

Merged
merged 54 commits into from
Jul 30, 2020
Merged

Conversation

sauravhiremath
Copy link
Contributor

@sauravhiremath sauravhiremath commented Jul 2, 2020

Summary ⚡

  • [Part 2 of 2] - Depends on [Part 1] Individual Test Case Report - Support custom messages  #10293
  • Initially jest runs would update testSuites incrementally, and update individual test cases batch-wise. This PR attempts to report the progress of the individual (atomic) test-cases.
  • Supported for Jest-Circus Runner.
  • Introduces eventListeners for the worker processes to send back the test results to their parent.
  • Handles progress reports both when running tests parallelly (spawning workers) and inBand (Sequentially).

Previous References and suggestions

Test plan ⚡

Current Implementation

implementation-demo

Authors

Co-author - Saurav M. H @sauravhiremath
Co-author - Kunal Kushwaha @kunal-kushwaha
Co-author - Rogelio Guzman @rogeliog

Acknowledgements

@kunal-kushwaha for his super awesome contribution 🚀 🚀
@rogeliog for laying down the foundation for this PR. 🚀
@SimenB and @jevakallio for their time and reviews 👏

packages/jest-runner/src/runTest.ts Outdated Show resolved Hide resolved
packages/jest-runner/src/index.ts Outdated Show resolved Hide resolved
packages/jest-runner/src/index.ts Show resolved Hide resolved
Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I think this is good to go! I'll hold off on merging until tomorrow to give more people the chance to review if they want.

Great job @kunal-kushwaha & @sauravhiremath! 👏

@SimenB SimenB requested a review from cpojer July 28, 2020 12:36
Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no blockers by any means, I just went over the whole PR holistically one last time 🙂

packages/jest-core/src/TestScheduler.ts Outdated Show resolved Hide resolved
packages/jest-reporters/src/utils.ts Outdated Show resolved Hide resolved
@@ -41,9 +41,9 @@ test('injects the serializable module map into each worker in watch mode', async
{context, path: './file2.test.js'},
],
new TestWatcher({isWatchMode: globalConfig.watch}),
() => {},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nice with some new tests that verify the correct events are emitted

packages/jest-types/src/TestResult.ts Outdated Show resolved Hide resolved
packages/jest-worker/src/workers/ChildProcessWorker.ts Outdated Show resolved Hide resolved
@SimenB
Copy link
Member

SimenB commented Jul 30, 2020

Can do #10227 (comment) when adding the test events discussed in #10227 (comment)

@SimenB SimenB changed the title [Part 2] Individual Test Case Report - Report Individual Test Cases feat: report Individual Test Cases Jul 30, 2020
@SimenB SimenB merged commit eb23ac1 into jestjs:master Jul 30, 2020
@retorquere
Copy link

In which release is this going to show up? And what do I have to change in my tests to make use of this?

@SimenB
Copy link
Member

SimenB commented Jul 30, 2020

It's released in 26.2.0, and you don't have to change anything beyond using jest-circus

@retorquere
Copy link

I don't know what I'm doing wrong, but I'm still seeing all tests output at once when the last one finishes, and nothing before. I've create an MWE at https://github.com/retorquere/jest-circus-test. Would appreciate feedback on what I should be doing differently.

@SimenB SimenB deleted the per-test-report branch December 23, 2020 17:46
@@ -90,18 +98,55 @@ class TestRunner {
if (watcher.isInterrupted()) {
throw new CancelRun();
}
let sendMessageToJest: JestTestFileEvent;

// Remove `if(onStart)` in Jest 27
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sauravhiremath @kunal-kushwaha you wouldn't by any chance be up for sending a PR removing onStart etc? 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SimenB I'll be happy to look into it 😄

@github-actions
Copy link

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

Successfully merging this pull request may close these issues.

Report progress of individual test cases
8 participants