Uh oh!
There was an error while loading. Please reload this page.
Revert https://github.com/nodejs/node/pull/56664 - #58282
Conversation
nodejs-github-bot
commented
May 11, 2025
Review requested:
|
pmarchini
commented
May 11, 2025
Hey @romainmenke , thanks for your contribution! Regarding the content of the PR: I think that, as the behaviour has already been implemented, it would be reasonable to try to make this behaviour configurable via a flag. |
romainmenke
commented
May 11, 2025
I think it is also reasonable to consider a straight up revert :) As I said in the pull request message, I don't think the change was sufficiently argued for.
Happy to look at this, but unsure how to proceed. |
Sorry, I only just noticed that the original PR landed without a squash commit!
I'd like to collect some feedback from @MoLow, @cjihrig, @jakecastelli, and @atlowChemi too! |
aduh95
commented
May 11, 2025
Could you give an example of something that no longer works with the new behavior in #51292, with a link to this PR? That should give everyone who participated in that issue a notification so they can participate in this discussion |
See: #51292 (comment) |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #58282 +/- ##
==========================================
+ Coverage 90.18% 90.21% +0.03%
==========================================
Files 631 633 +2 Lines 186689 186793 +104 Branches 36663 36672 +9 ==========================================
+ Hits 168359 168519 +160 + Misses 11128 11045 -83 - Partials 7202 7229 +27
🚀 New features to boost your workflow:
|
pmarchini
commented
May 11, 2025
I think we should avoid reverting this feature and instead explore an idea that aligns with the current direction: the addition of a Here’s an example, based on what you shared in the other issue, of what it could look like using steps: import{test}from'node:test';importassertfrom'node:assert';test('outer',async(t1)=>{leta=1;letb=1;// Run a first sub testt1.test('inner 1',async(t2)=>{awaitnewPromise((resolve)=>setTimeout(resolve,1000));assert.equal(a,b);t2.after(async()=>{awaitnewPromise((resolve)=>{b=2;resolve();});});});// Do some async workload in between sub testst1.step('async workload',async()=>newPromise((resolve)=>{b=2;resolve();}));// Run a second sub testt1.test('inner 2',async()=>{// Run some extra assertsassert.equal(b,2);});});Something like this could potentially address the issue while avoiding the reintroduction of the discrepancy between |
Such new API doesn't really help when we still support a wide range of node versions. I also honestly do not understand how this change got through in the first place. Before the change made in #56664 it was possible to intuitively and organically add sub tests in between existing code. Or to add some non-test code in between sub tests After #56664 you have to be very careful that in a given test you either have only sub tests or only non-sub test code. You can no longer interleave these without race conditions. This is clearly bad, right? I really liked that |
mcollina
commented
May 12, 2025
I concur on a quick revert. |
mcollina
commented
May 12, 2025
@romainmenke can you please amend the other tests that are failing? |
aduh95
commented
May 12, 2025
Tests are failing on GHA, I don't think it makes sense to run Jenkins CI now |
pmarchini
commented
May 12, 2025
As far as I can tell, it seems that #57672 is the origin of the failing tests (cc @jakecastelli). You can do it via Unfortunately, I just tried and it seems that the behavior introduced by #57672 is broken after the revert. |
marco-ippolito
left a comment
There was a problem hiding this comment.
I agree the previous behavior was more sane
pmarchini
commented
May 13, 2025
If nobody precedes me, I'll take a look at the failing tests ASAP. |
After thinking about it I changed my mind, the use case provided is very uncommon and not worth reverting. Maybe we should provide another setting/api that returns a promise
pmarchini
commented
May 14, 2025
Hey @romainmenke, if you want, you can cherry-pick my latest commit from #58320. After this commit, I think everything is in place for a potential revert. IMHO, reverting is still not the right choice, and finding an alternative way to provide this capability would be much better from a DevEx/consistency perspective. I won't accept this PR for that reason. I provided support to avoid blocking progress in case a decision is made to revert. I've seen that we have a |
Reverting feels like optimizing for the edge case instead of the most common case. I'm not a contributor, so I don't know how much my opinion matters, but not being able to lint with |
alcuadrado
commented
Jun 19, 2025
Paraphrasing, @mcollina, it feels a bit like this: ![]() |
LiviaMedeiros
commented
Jun 21, 2025
@nodejs/tsc given that this was on the
tsc-agenda The consensus seems to be that there's slight chance of partial revert to be breaking, I suggest to simply merge this right away as-is. After that,
|
nodejs-github-bot
commented
Jun 23, 2025
Landed in af66574...04cb572 |
LiviaMedeiros
commented
Jun 23, 2025
@romainmenke thanks for the contribution! |
romainmenke
commented
Jun 23, 2025
Thank you everyone for the help and thoughtful approach to this change 🙇 |
The
notable-change Please suggest a text for the release notes if you'd like to include a more detailed summary, then proceed to update the PR description with the text or a link to the notable change suggested text comment. Otherwise, the commit will be placed in the Other Notable Changes section. |
LiviaMedeiros
commented
Jun 23, 2025
Retroactively adding
notable-change |
Notable changes: doc: * add islandryu to collaborators (Shima Ryuhei) #58714 fs: * (SEMVER-MINOR) allow correct handling of burst in fs-events with AsyncIterator (Philipp Dunkel) #58490 module: * (SEMVER-MINOR) remove experimental warning from type stripping (Marco Ippolito) #58643 test: * fix test-timeout-flag after revert of auto subtest wait (Pietro Marchini) #58282 test_runner: * Revert "test_runner: remove promises returned by t.test() (Romain Menke) #58282 * Revert "test_runner: remove promises returned by test() (Romain Menke) #58282 * Revert "test_runner: automatically wait for subtests to finish (Romain Menke) #58282 * (SEMVER-MINOR) support object property mocking (Idan Goshen) #58438 url: * (SEMVER-MINOR) add fileURLToPathBuffer API (James M Snell) #58700 PR-URL: #58813
Notable changes: doc: * add islandryu to collaborators (Shima Ryuhei) #58714 fs: * (SEMVER-MINOR) allow correct handling of burst in fs-events with AsyncIterator (Philipp Dunkel) #58490 module: * (SEMVER-MINOR) remove experimental warning from type stripping (Marco Ippolito) #58643 test: * fix test-timeout-flag after revert of auto subtest wait (Pietro Marchini) #58282 test_runner: * (SEMVER-MINOR) support object property mocking (Idan Goshen) #58438 url: * (SEMVER-MINOR) add fileURLToPathBuffer API (James M Snell) #58700 PR-URL: #58813
Notable changes: doc: * add islandryu to collaborators (Shima Ryuhei) #58714 fs: * (SEMVER-MINOR) allow correct handling of burst in fs-events with AsyncIterator (Philipp Dunkel) #58490 module: * (SEMVER-MINOR) remove experimental warning from type stripping (Marco Ippolito) #58643 test: * fix test-timeout-flag after revert of auto subtest wait (Pietro Marchini) #58282 test_runner: * (SEMVER-MINOR) support object property mocking (Idan Goshen) #58438 url: * (SEMVER-MINOR) add fileURLToPathBuffer API (James M Snell) #58700 PR-URL: #58813

Being able to
awaitsub tests and orchestrate the order of sub tests and other async functions was no longer possible after #56664I think this was an obvious mistake.
As far as I understand from #51292 the original issue was that sometimes people get linter nags.
No one actually sufficiently argued that the previous behavior was either wrong or not a useful capability.
I suggest the changes are reverted to restore the previous capabilities.
Being able to await sub tests was a really useful feature.
The linter concerns should be secondary to the capabilities of
node:testFixes: #58227