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

[Bug]: Add top level endTime when using --json reporter #15103

Open
pdehaan opened this issue Jun 2, 2024 · 1 comment
Open

[Bug]: Add top level endTime when using --json reporter #15103

pdehaan opened this issue Jun 2, 2024 · 1 comment

Comments

@pdehaan
Copy link

pdehaan commented Jun 2, 2024

Version

29.7.0

Steps to reproduce

  1. Add basic sum.js and sum.test.js getting started.
  2. jest --json --outputFile=jest.json --testLocationInResults --verbose
  3. Inspect the generated jest.json report.

Expected behavior

Top level startTime and endTime in the generated results file. We're trying to build a dashboard for Jest and Playwright and build times so we can track them for the past n days, but I'm only seeing the total test time reported in STDOUT and not in the outputFile, which makes it tricky.

Actual behavior

startTime but no endTime (so we can calculate test execution duration)

// jest.json
{
  "numFailedTestSuites": 0,
  "numFailedTests": 0,
  "numPassedTestSuites": 1,
  "numPassedTests": 1,
  "numPendingTestSuites": 0,
  "numPendingTests": 0,
  "numRuntimeErrorTestSuites": 0,
  "numTodoTests": 0,
  "numTotalTestSuites": 1,
  "numTotalTests": 1,
  "openHandles": [],
  "snapshot": { ... },
  "startTime": 1717304192877,
  "success": true,
  "testResults": [ ... ],
  "wasInterrupted": false
}

Versus STDOUT's output:

jest --json --outputFile=jest.json --testLocationInResults --verbose

 PASS  ./sum.test.js
  ✓ adds 1 + 2 to equal 3 (1 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        0.1 s, estimated 1 s
Ran all test suites.
Test results written to: jest.json

Additional context

No response

Environment

System:
    OS: macOS 14.5
    CPU: (10) arm64 Apple M1 Max
  Binaries:
    Node: 22.2.0 - ~/.nvm/versions/node/v22.2.0/bin/node
    npm: 10.7.0 - ~/.nvm/versions/node/v22.2.0/bin/npm
  npmPackages:
    jest: ^29.7.0 => 29.7.0
Copy link

github-actions bot commented Jul 2, 2024

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 github-actions bot added the Stale label Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant