-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
test_runner: simplify test time tracking #52182
Conversation
This commit simplifies the logic for tracking test start time. The start time is now set only when a test/suite begins running. If the test/suite never runs, a fallback is provided in postRun().
Review requested:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I get why these changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The spec reporter only shows times if they are non-zero. Those values were coming through as zeros before. I have now updated the PR as shown below. That seems to keep the snapshots the same, which can also save a second hrtime()
call. Please take another look.
diff --git a/lib/internal/test_runner/test.js b/lib/internal/test_runner/test.js
index f61aada409..9f9c47edae 100644
--- a/lib/internal/test_runner/test.js
+++ b/lib/internal/test_runner/test.js
@@ -754,8 +754,8 @@ class Test extends AsyncResource {
postRun(pendingSubtestsError) {
// If the test was cancelled before it started, then the start and end
// times need to be corrected.
- this.startTime ??= hrtime();
this.endTime ??= hrtime();
+ this.startTime ??= this.endTime;
// The test has run, so recursively cancel any outstanding subtests and
// mark this test as failed if any subtests failed.
This commit simplifies the logic for tracking test end time. The end time is now only set in postRun(), which every test runs when it ends.
Landed in a8b21fd...6af4049 |
This commit simplifies the logic for tracking test start time. The start time is now set only when a test/suite begins running. If the test/suite never runs, a fallback is provided in postRun(). PR-URL: #52182 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Chemi Atlow <[email protected]>
This commit simplifies the logic for tracking test end time. The end time is now only set in postRun(), which every test runs when it ends. PR-URL: #52182 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Chemi Atlow <[email protected]>
This commit simplifies the logic for tracking test start time. The start time is now set only when a test/suite begins running. If the test/suite never runs, a fallback is provided in postRun(). PR-URL: nodejs#52182 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Chemi Atlow <[email protected]>
This commit simplifies the logic for tracking test end time. The end time is now only set in postRun(), which every test runs when it ends. PR-URL: nodejs#52182 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Chemi Atlow <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
This commit simplifies the logic for tracking test start time. The start time is now set only when a test/suite begins running. If the test/suite never runs, a fallback is provided in postRun(). PR-URL: nodejs#52182 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Chemi Atlow <[email protected]>
This commit simplifies the logic for tracking test end time. The end time is now only set in postRun(), which every test runs when it ends. PR-URL: nodejs#52182 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Chemi Atlow <[email protected]>
This commit simplifies the logic for tracking test start time. The start time is now set only when a test/suite begins running. If the test/suite never runs, a fallback is provided in postRun(). PR-URL: #52182 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Chemi Atlow <[email protected]>
This commit simplifies the logic for tracking test end time. The end time is now only set in postRun(), which every test runs when it ends. PR-URL: #52182 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Chemi Atlow <[email protected]>
This commit simplifies the logic for tracking test start time. The start time is now set only when a test/suite begins running. If the test/suite never runs, a fallback is provided in postRun(). PR-URL: #52182 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Chemi Atlow <[email protected]>
This commit simplifies the logic for tracking test end time. The end time is now only set in postRun(), which every test runs when it ends. PR-URL: #52182 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Chemi Atlow <[email protected]>
This PR simplifies some of the logic that has accumulated over time for tracking test durations.
test_runner: simplify test start time tracking
This commit simplifies the logic for tracking test start time.
The start time is now set only when a test/suite begins running.
If the test/suite never runs, a fallback is provided in postRun().
test_runner: simplify test end time tracking
This commit simplifies the logic for tracking test end time.
The end time is now only set in postRun(), which every test
runs when it ends.