-
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: don't await the same promise for each test #52185
Conversation
This commit updates a test runner fixture that includes a failing child test. However, the nested test is created using the top level test() function instead t.test(). This commit updates the fixture to use t.test(), while preserving the expected failure. Refs: nodejs#47164
Prior to this commit, each top level test awaited the same global promise for setting up test reporters. This commit updates the logic to only await the promise the first time it is encountered.
Review requested:
|
if (reportersSetup) { | ||
// Only incur the overhead of awaiting the Promise once. | ||
await reportersSetup; | ||
reportersSetup = undefined; | ||
} |
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.
Do you happen to have any benchmarking for this change?
Did anything specific raise this change?
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.
@cjihrig I am curious as well what impact this has. is it that expensive to await the same promise multiple times?
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.
@MoLow see my comment in #52185 (comment). The issue is just that even after the promise is settled, awaiting it costs another tick. Quoting MDN:
Even when the used promise is already fulfilled, the async function's execution still pauses until the next tick.
It just seemed like a simple way to eliminate some overhead.
Landed in bae14b7...4648c83 |
This commit updates a test runner fixture that includes a failing child test. However, the nested test is created using the top level test() function instead t.test(). This commit updates the fixture to use t.test(), while preserving the expected failure. Refs: #47164 PR-URL: #52185 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Prior to this commit, each top level test awaited the same global promise for setting up test reporters. This commit updates the logic to only await the promise the first time it is encountered. PR-URL: #52185 Refs: #47164 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This commit updates a test runner fixture that includes a failing child test. However, the nested test is created using the top level test() function instead t.test(). This commit updates the fixture to use t.test(), while preserving the expected failure. Refs: nodejs#47164 PR-URL: nodejs#52185 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Prior to this commit, each top level test awaited the same global promise for setting up test reporters. This commit updates the logic to only await the promise the first time it is encountered. PR-URL: nodejs#52185 Refs: nodejs#47164 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This commit updates a test runner fixture that includes a failing child test. However, the nested test is created using the top level test() function instead t.test(). This commit updates the fixture to use t.test(), while preserving the expected failure. Refs: nodejs#47164 PR-URL: nodejs#52185 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Prior to this commit, each top level test awaited the same global promise for setting up test reporters. This commit updates the logic to only await the promise the first time it is encountered. PR-URL: nodejs#52185 Refs: nodejs#47164 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This commit updates a test runner fixture that includes a failing child test. However, the nested test is created using the top level test() function instead t.test(). This commit updates the fixture to use t.test(), while preserving the expected failure. Refs: #47164 PR-URL: #52185 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Prior to this commit, each top level test awaited the same global promise for setting up test reporters. This commit updates the logic to only await the promise the first time it is encountered. PR-URL: #52185 Refs: #47164 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This commit updates a test runner fixture that includes a failing child test. However, the nested test is created using the top level test() function instead t.test(). This commit updates the fixture to use t.test(), while preserving the expected failure. Refs: #47164 PR-URL: #52185 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Prior to this commit, each top level test awaited the same global promise for setting up test reporters. This commit updates the logic to only await the promise the first time it is encountered. PR-URL: #52185 Refs: #47164 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
test: fix incorrect test fixture
This commit updates a test runner fixture that includes a failing
child test. However, the nested test is created using the top
level
test()
function insteadt.test()
. This commit updates thefixture to use
t.test()
, while preserving the expected failure.Refs: #47164
test_runner: don't await the same promise for each test
Prior to this commit, each top level test awaited the same
global promise for setting up test reporters. This commit
updates the logic to only await the promise the first time
it is encountered.