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

pass startedAt onTestCaseResult #15145

Merged
merged 8 commits into from
Jul 16, 2024
Merged

Conversation

RahulARanger
Copy link
Contributor

Summary

This PR is to provide the started timestamp inside of the TestCaseResult object passed in custom reporter's onTestCaseResult

  • Passed started timestamp in parseSingleTestResult
  • Typings: Added started type in TestCaseResult Object

if we modify AssertionCountsReporter in e2e/customReporters

 onTestCaseResult(test, testCaseResult) {
    console.log(
      `onTestCaseResult: ${testCaseResult.title}, ` +
        `status: ${testCaseResult.status}, ` +
        `numExpectations: ${new Date(testCaseResult.startedAt)}`,
    );
  }

then notice we would get startedAt in onTestCaseResult

Determining test suites to run...onTestCaseResult: adds fail, status: failed, numExpectations: Sun Jun 23 2024 02:02:39 GMT+0530 (India Standard Time)
onTestFileResult testCaseResult 0: adds fail, status: failed, numExpectations: 0
onTestFileResult testCaseResult 0: sample, status: pending, numExpectations: 0
onTestCaseResult: test 1, status: passed, numExpectations: Sun Jun 23 2024 02:02:39 GMT+0530 (India Standard Time)
onTestCaseResult: test 2, status: passed, numExpectations: Sun Jun 23 2024 02:02:39 GMT+0530 (India Standard Time)
onTestFileResult testCaseResult 0: test 1, status: passed, numExpectations: 1    
onTestFileResult testCaseResult 1: test 2, status: passed, numExpectations: 1    
onTestCaseResult: adds ok, status: passed, numExpectations: Sun Jun 23 2024 02:02:39 GMT+0530 (India Standard Time)
onTestFileResult testCaseResult 0: adds ok, status: passed, numExpectations: 3
onTestCaseResult: sample, status: todo, numExpectations: Sun Jun 23 2024 02:02:40 GMT+0530 (India Standard Time)
onTestFileResult testCaseResult 0: sample, status: todo, numExpectations: 0

Test plan

should not break existing tests

Copy link

netlify bot commented Jun 22, 2024

Deploy Preview for jestjs ready!

Name Link
🔨 Latest commit 550dfba
🔍 Latest deploy log https://app.netlify.com/sites/jestjs/deploys/6696d63a47548e000830f240
😎 Deploy Preview https://deploy-preview-15145--jestjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@RahulARanger RahulARanger changed the title Custom reporter result pass startedAt onTestCaseResult Jun 22, 2024
@RahulARanger
Copy link
Contributor Author

reverting changelog as it would cause merge conflict;

changelog added;

  • [jest-circus, jest-test-result] Pass startedAt timestamp in TestCaseResultObject seen in onTestCaseResult (#15145)

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 for sending a PR!

Please keep the changelog entry in - I can deal with any merge conflicts when landing.


Can you add a test?

@RahulARanger
Copy link
Contributor Author

sure, will add a test case.

@RahulARanger RahulARanger requested a review from SimenB July 16, 2024 19:04
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!

@SimenB SimenB merged commit 41f842a into jestjs:main Jul 16, 2024
8 of 9 checks passed
@SimenB
Copy link
Member

SimenB commented Aug 8, 2024

https://github.com/jestjs/jest/releases/tag/v30.0.0-alpha.6

Copy link

github-actions bot commented Sep 8, 2024

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

Successfully merging this pull request may close these issues.

2 participants