| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Review requested:
|
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
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, something went wrong.
Sorry, I only just noticed that the original PR landed without a squash commit!
Personally I agree, IMHO we already have suite-test/describe-it that covers that use case. I'd like to collect some feedback from @MoLow, @cjihrig, @jakecastelli, and @atlowChemi too! |
Sorry, something went wrong.
|
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 |
Sorry, something went wrong.
|
See: #51292 (comment) |
Sorry, something went wrong.
Codecov ReportAttention: Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
@@ 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
... and 41 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
|
I think we should avoid reverting this feature and instead explore an idea that aligns with the current direction: the addition of a step method similar to what Deno provides. 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';
import assert from 'node:assert';
test('outer', async (t1) => {
let a = 1;
let b = 1;
// Run a first sub test
t1.test('inner 1', async (t2) => {
await new Promise((resolve) => setTimeout(resolve, 1000));
assert.equal(a, b);
t2.after(async () => {
await new Promise((resolve) => {
b = 2;
resolve();
});
});
});
// Do some async workload in between sub tests
t1.step('async workload', async () => new Promise((resolve) => {
b = 2;
resolve();
}));
// Run a second sub test
t1.test('inner 2', async () => {
// Run some extra asserts
assert.equal(b, 2);
});
});Something like this could potentially address the issue while avoiding the reintroduction of the discrepancy between suite/test and t.test. |
Sorry, something went wrong.
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 node:test and node --test foo.mjs had the core principle that every test is just a JavaScript program and that there weren't any gotcha's. It's just JavaScript code as any other JavaScript code. After #56664 I think this is no longer true. You have to carefully keep within the bounds of the "framework" or your tests won't work as expected. |
Sorry, something went wrong.
There was a problem hiding this comment.
lgtm
Sorry, something went wrong.
|
I concur on a quick revert. |
Sorry, something went wrong.
|
@romainmenke can you please amend the other tests that are failing? |
Sorry, something went wrong.
|
Tests are failing on GHA, I don't think it makes sense to run Jenkins CI now |
Sorry, something went wrong.
|
As far as I can tell, it seems that #57672 is the origin of the failing tests (cc @jakecastelli). You can do it via NODE_REGENERATE_SNAPSHOTS=1 out/Release/node --expose-internals test/parallel/test-runner-output.mjs. Unfortunately, I just tried and it seems that the behavior introduced by #57672 is broken after the revert. |
Sorry, something went wrong.
There was a problem hiding this comment.
I agree the previous behavior was more sane
Sorry, something went wrong.
|
If nobody precedes me, I'll take a look at the failing tests ASAP. |
Sorry, something went wrong.
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
|
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 tsc-agenda set, so let's see! |
Sorry, something went wrong.
|
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 no-floating-promises in tests is a huge drawback. |
Sorry, something went wrong.
|
Paraphrasing, @mcollina, it feels a bit like this:
|
Sorry, something went wrong.
|
@nodejs/tsc given that this was on the tsc-agenda Issues and PRs to discuss during the meetings of the TSC. for several meetings and no objections were raised, is there any reason to keep this PR in its current state? 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,
|
Sorry, something went wrong.
|
@romainmenke thanks for the contribution! |
Sorry, something went wrong.
|
Thank you everyone for the help and thoughtful approach to this change 🙇 |
Sorry, something went wrong.
|
The notable-change PRs with changes that should be highlighted in changelogs. label has been added by @LiviaMedeiros. 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. |
Sorry, something went wrong.
|
Retroactively adding notable-change PRs with changes that should be highlighted in changelogs. , we probably should reflect in the changelog that subtests can/should be awaited again. |
Sorry, something went wrong.
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
| Back | FazBrowse Home | New Git URL |
Being able to await sub tests and orchestrate the order of sub tests and other async functions was no longer possible after #56664
I 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:test
Fixes: #58227