fix(junit): fix testsuites time to be sum of all testsuite items #6985
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
not the total time of execution
Description
This addresses 2 problems, one that is general to junit reporter itself, but more debatable, and the other one is merge-reports specific, but is clearly a bug. Let's start with the first one.
testsuites.time
is anwhich makes sense
But the current implementation uses
new Date().getTime() - this._timeStart.getTime()
, so like, total execution time, including transform, prepare and so on. Which IMO should be changed to aggregated sum--merge-reports --reporter=junit
thetestsuites.time
would be completely wrong (due to it being execution time of reports merging, not the tests times aggregation). This is not a junit-only problem, it also affect text reporters, but I'm not sure what is the correct behaviour for them, so I focused on junit here.I specifically found it when merging reports, since we calculate mean test time by doing
testsuites.time / (testsuites.total - testsuites.skipped)
, and noticed that mean time suddenly dropped down to nanoseconds (I wish it would, though!)Xml tests are just best-effort, I'd like to use a proper parser, so let me know if they will suffice or not
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yaml
unless you introduce a new test example.Tests
pnpm test:ci
.Documentation
pnpm run docs
command.Changesets
feat:
,fix:
,perf:
,docs:
, orchore:
.