summaryrefslogtreecommitdiff
path: root/test/parallel/test-promises-unhandled-rejections.js
diff options
context:
space:
mode:
authorVladimir Kurchatkin <vladimir.kurchatkin@gmail.com>2015-06-11 23:08:17 +0300
committerVladimir Kurchatkin <vladimir.kurchatkin@gmail.com>2015-06-13 00:24:24 +0300
commita2516570589db22ffa142644b0e633f22b293c32 (patch)
tree2294ebf74994395c241882abfb941a0e9213cdb6 /test/parallel/test-promises-unhandled-rejections.js
parent03ce84dfa13a1cc075bb45772a8a566213148939 (diff)
downloadnode-new-a2516570589db22ffa142644b0e633f22b293c32.tar.gz
node: mark promises as handled as soon as possible
Fixes: https://github.com/nodejs/io.js/issues/1912 PR-URL: https://github.com/nodejs/io.js/pull/1952 Reviewed-By: Domenic Denicola <d@domenic.me> Reviewed-By: Petka Antonov <petka_antonov@hotmail.com>
Diffstat (limited to 'test/parallel/test-promises-unhandled-rejections.js')
-rw-r--r--test/parallel/test-promises-unhandled-rejections.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/parallel/test-promises-unhandled-rejections.js b/test/parallel/test-promises-unhandled-rejections.js
index 9a186de8df..e5b3e6f35c 100644
--- a/test/parallel/test-promises-unhandled-rejections.js
+++ b/test/parallel/test-promises-unhandled-rejections.js
@@ -275,6 +275,21 @@ asyncTest('Attaching a promise catch in a process.nextTick is soon enough to' +
});
});
+asyncTest('While inside setImmediate, catching a rejected promise derived ' +
+ 'from returning a rejected promise in a fulfillment handler ' +
+ 'prevents unhandledRejection', function(done) {
+ onUnhandledFail(done);
+
+ setImmediate(function() {
+ // reproduces on first tick and inside of setImmediate
+ Promise
+ .resolve('resolve')
+ .then(function() {
+ return Promise.reject('reject');
+ }).catch(function(e) {});
+ });
+});
+
// State adapation tests
asyncTest('catching a promise which is asynchronously rejected (via' +
'resolution to an asynchronously-rejected promise) prevents' +