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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

RahulARanger
Copy link

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!

Built without sensitive environment variables

Name Link
🔨 Latest commit 4df82dd
🔍 Latest deploy log https://app.netlify.com/sites/jestjs/deploys/6685a2582f92f80008c2ccab
😎 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant