[Bug]: Add top level `endTime` when using --json reporter
pdehaan opened this issue · 4 comments
pdehaan commented
Version
29.7.0
Steps to reproduce
- Add basic sum.js and sum.test.js getting started.
- jest --json --outputFile=jest.json --testLocationInResults --verbose
- 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