diagnostics_channel: return original thenable#62407
Conversation
fc213c4 to
3eb07ea
Compare
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #62407 +/- ##
=======================================
Coverage 89.77% 89.77%
=======================================
Files 697 697
Lines 215773 215782 +9
Branches 41304 41300 -4
=======================================
+ Hits 193704 193713 +9
+ Misses 14162 14158 -4
- Partials 7907 7911 +4
π New features to boost your workflow:
|
Renegade334
left a comment
There was a problem hiding this comment.
Does this change have a specific case in mind? The A+ standard mandates .then() to return another "promise" instance (either the same object or a new object at the implementation's discretion), so any custom features of a compliant thenable should also be present on the object returned by .then()?
|
No, that is not the case. A thenable can return any variety of promise, not necessarily another of itself. It's most common that a thenable returns native promises from its then/catch, so you lose access to whatever methods it had when following the chain. |
3eb07ea to
3d95103
Compare
3d95103 to
c5fcc50
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Failed to start CI- Validating Jenkins credentials β Jenkins credentials valid - Querying data for job/node-test-pull-request/72280/ [SyntaxError: Unexpected token '<', ..." https://github.com/nodejs/node/actions/runs/27762715319 |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This makes tracePromise return the original thenable to allow custom thenable types to retain their methods rather than producing the chained result type. Signed-off-by: Stephen Belanger <admin@stephenbelanger.com>
1a3b143 to
09ee7c0
Compare
|
Jenkins is passing. Github Actions seems to have an unrelated failure though. |
|
Rebasing on a40bb49 would get GHA green, but rather than re-running everything, I suggest we just manually land this instead. |
|
Does commit-queue actually consider GHA failures? I thought it only cared about Jenkins. My thinking was to just use that with that assumption. |
It would complain, aye. |
This makes tracePromise return the original thenable to allow custom thenable types to retain their methods rather than producing the chained result type.
This branches the behaviour between native promises and thenables such that native promises retain the correct unhandledRejection behaviour while thenables produce the correct original return value and so retain methods present on that type.
I think that because native promises are consistently shaped it doesn't actually matter that it remains chained rather than branched.
cc @nodejs/diagnostics