Linux lt2.cfware.com 5.3.11-200.fc30.x86_64 #1 SMP Tue Nov 12 19:25:25 UTC 2019 x86_64 x86_64 x86_64 GNU/LinuxTake the following script:
'use strict';
Promise.reject('rejection 1');
Promise.reject('rejection 2').catch(() => {});
The expected result is an unhandledRejection for rejection 1. This script produces no warnings on node.js 12 or 13.
Something like this might help?
diff --git a/lib/internal/process/promises.js b/lib/internal/process/promises.js
index 35ebb39115f3..7cd40f96cc98 100644
--- a/lib/internal/process/promises.js
+++ b/lib/internal/process/promises.js
@@ -125,7 +125,8 @@ function handledRejection(promise) {
return;
}
}
- setHasRejectionToWarn(false);
+ if (maybeUnhandledPromises.size === 0 && asyncHandledRejections.length === 0)
+ setHasRejectionToWarn(false);
}
const unhandledRejectionErrName = 'UnhandledPromiseRejectionWarning';
@nodejs/promises-debugging @joyeecheung (I think this might have come from bf566718b29a6fae8cef8d0fecd7e77948726d5a)
@addaleax Yeah, that鈥檚 likely, as the PR only passed whatever test we had and this does not seem to be tested by us.
Most helpful comment
Something like this might help?
@nodejs/promises-debugging @joyeecheung (I think this might have come from bf566718b29a6fae8cef8d0fecd7e77948726d5a)