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 commented Jul 2, 2020

Summary

  • [Part 2 of 2] - Depends on #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

  • Add custom message support in jest-worker
  • Update onCustomMessage functions to pass tests (caused by updating its Type)
    API implemented as suggested here - #6616 (comment)
  • Fix the memory leak issue

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 👏

rogeliog and others added 28 commits Sep 28, 2019
@kunal-kushwaha kunal-kushwaha force-pushed the MLH-Fellowship:per-test-report branch from 0be2e81 to 69a6aa7 Jul 28, 2020
packages/jest-runner/src/runTest.ts Outdated Show resolved Hide resolved
packages/jest-runner/src/runTest.ts Outdated Show resolved Hide resolved
packages/jest-runner/src/runTest.ts Outdated Show resolved Hide resolved
packages/jest-runner/src/runTest.ts Outdated Show resolved Hide resolved
packages/jest-runner/src/testWorker.ts Outdated Show resolved Hide resolved
packages/jest-runner/src/runTest.ts Outdated Show resolved Hide resolved
packages/jest-runner/src/index.ts Outdated Show resolved Hide resolved
@kunal-kushwaha kunal-kushwaha force-pushed the MLH-Fellowship:per-test-report branch from 9296d86 to d08c35d Jul 28, 2020
@SimenB
SimenB approved these changes Jul 28, 2020
packages/jest-runner/src/index.ts Show resolved Hide resolved
@SimenB
SimenB approved these changes Jul 28, 2020
Copy link
Collaborator

SimenB left a comment

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 Jul 28, 2020
Copy link
Collaborator

SimenB left a comment

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}),
() => {},

This comment has been minimized.

@SimenB

SimenB Jul 29, 2020 Collaborator

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
@SimenB
Copy link
Collaborator

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 facebook:master Jul 30, 2020
23 checks passed
23 checks passed
cleanup-runs
Details
Running TypeScript compiler & ESLint
Details
Node v10.x on ubuntu-latest
Details
Node v10.x on macOS-latest
Details
Node v10.x on windows-latest
Details
Node v12.x on ubuntu-latest
Details
Node v12.x on macOS-latest
Details
Node v12.x on windows-latest
Details
Node v13.x on ubuntu-latest
Details
Node v13.x on macOS-latest
Details
Node v13.x on windows-latest
Details
Node v14.x on ubuntu-latest
Details
Node v14.x on macOS-latest
Details
Node v14.x on windows-latest
Details
Facebook CLA Check Contributor License Agreement is valid!
Details
ci/circleci: test-jest-circus Your tests passed on CircleCI!
Details
ci/circleci: test-node-10 Your tests passed on CircleCI!
Details
ci/circleci: test-node-12 Your tests passed on CircleCI!
Details
ci/circleci: test-node-13 Your tests passed on CircleCI!
Details
ci/circleci: test-node-14 Your tests passed on CircleCI!
Details
ci/circleci: test-or-deploy-website Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
facebook.jest #20200730.3 succeeded
Details
@retorquere
Copy link

retorquere commented Jul 30, 2020

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
Collaborator

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

retorquere commented Aug 2, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

8 participants
You can’t perform that action at this time.