Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4e019f0

Browse filesBrowse files
duradMylesBorins
authored andcommitted
test: reversed params in assert.strictEqual()
Reversed parameters of assert.strictEqual() in test-promises-unhandled-rejections.js so that first one is actual and second one is expected value. PR-URL: #23591 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
1 parent f216699 commit 4e019f0
Copy full SHA for 4e019f0

File tree

Expand file treeCollapse file tree

1 file changed

+39
-39
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+39
-39
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-promises-unhandled-rejections.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-promises-unhandled-rejections.js
+39-39Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ asyncTest('synchronously rejected promise should trigger' +
112112
' unhandledRejection', function(done) {
113113
const e = new Error();
114114
onUnhandledSucceed(done, function(reason, promise) {
115-
assert.strictEqual(e, reason);
115+
assert.strictEqual(reason, e);
116116
});
117117
Promise.reject(e);
118118
});
@@ -121,7 +121,7 @@ asyncTest('synchronously rejected promise should trigger' +
121121
' unhandledRejection', function(done) {
122122
const e = new Error();
123123
onUnhandledSucceed(done, function(reason, promise) {
124-
assert.strictEqual(e, reason);
124+
assert.strictEqual(reason, e);
125125
});
126126
new Promise(function(_, reject) {
127127
reject(e);
@@ -132,7 +132,7 @@ asyncTest('Promise rejected after setImmediate should trigger' +
132132
' unhandledRejection', function(done) {
133133
const e = new Error();
134134
onUnhandledSucceed(done, function(reason, promise) {
135-
assert.strictEqual(e, reason);
135+
assert.strictEqual(reason, e);
136136
});
137137
new Promise(function(_, reject) {
138138
setImmediate(function() {
@@ -145,7 +145,7 @@ asyncTest('Promise rejected after setTimeout(,1) should trigger' +
145145
' unhandled rejection', function(done) {
146146
const e = new Error();
147147
onUnhandledSucceed(done, function(reason, promise) {
148-
assert.strictEqual(e, reason);
148+
assert.strictEqual(reason, e);
149149
});
150150
new Promise(function(_, reject) {
151151
setTimeout(function() {
@@ -158,7 +158,7 @@ asyncTest('Catching a promise rejection after setImmediate is not' +
158158
' soon enough to stop unhandledRejection', function(done) {
159159
const e = new Error();
160160
onUnhandledSucceed(done, function(reason, promise) {
161-
assert.strictEqual(e, reason);
161+
assert.strictEqual(reason, e);
162162
});
163163
let _reject;
164164
const promise = new Promise(function(_, reject) {
@@ -175,11 +175,11 @@ asyncTest('When re-throwing new errors in a promise catch, only the' +
175175
const e = new Error();
176176
const e2 = new Error();
177177
onUnhandledSucceed(done, function(reason, promise) {
178-
assert.strictEqual(e2, reason);
179-
assert.strictEqual(promise2, promise);
178+
assert.strictEqual(reason, e2);
179+
assert.strictEqual(promise, promise2);
180180
});
181181
const promise2 = Promise.reject(e).then(assert.fail, function(reason) {
182-
assert.strictEqual(e, reason);
182+
assert.strictEqual(reason, e);
183183
throw e2;
184184
});
185185
});
@@ -188,7 +188,7 @@ asyncTest('Test params of unhandledRejection for a synchronously-rejected ' +
188188
'promise', function(done) {
189189
const e = new Error();
190190
onUnhandledSucceed(done, function(reason, promise) {
191-
assert.strictEqual(e, reason);
191+
assert.strictEqual(reason, e);
192192
assert.strictEqual(promise, promise);
193193
});
194194
Promise.reject(e);
@@ -200,15 +200,15 @@ asyncTest('When re-throwing new errors in a promise catch, only the ' +
200200
const e = new Error();
201201
const e2 = new Error();
202202
onUnhandledSucceed(done, function(reason, promise) {
203-
assert.strictEqual(e2, reason);
204-
assert.strictEqual(promise2, promise);
203+
assert.strictEqual(reason, e2);
204+
assert.strictEqual(promise, promise2);
205205
});
206206
const promise2 = new Promise(function(_, reject) {
207207
setTimeout(function() {
208208
reject(e);
209209
}, 1);
210210
}).then(assert.fail, function(reason) {
211-
assert.strictEqual(e, reason);
211+
assert.strictEqual(reason, e);
212212
throw e2;
213213
});
214214
});
@@ -219,15 +219,15 @@ asyncTest('When re-throwing new errors in a promise catch, only the re-thrown' +
219219
const e = new Error();
220220
const e2 = new Error();
221221
onUnhandledSucceed(done, function(reason, promise) {
222-
assert.strictEqual(e2, reason);
223-
assert.strictEqual(promise2, promise);
222+
assert.strictEqual(reason, e2);
223+
assert.strictEqual(promise, promise2);
224224
});
225225
const promise = new Promise(function(_, reject) {
226226
setTimeout(function() {
227227
reject(e);
228228
process.nextTick(function() {
229229
promise2 = promise.then(assert.fail, function(reason) {
230-
assert.strictEqual(e, reason);
230+
assert.strictEqual(reason, e);
231231
throw e2;
232232
});
233233
});
@@ -308,7 +308,7 @@ asyncTest('catching a promise which is asynchronously rejected (via ' +
308308
}, 1);
309309
});
310310
}).then(assert.fail, function(reason) {
311-
assert.strictEqual(e, reason);
311+
assert.strictEqual(reason, e);
312312
});
313313
});
314314

@@ -319,7 +319,7 @@ asyncTest('Catching a rejected promise derived from throwing in a' +
319319
Promise.resolve().then(function() {
320320
throw e;
321321
}).then(assert.fail, function(reason) {
322-
assert.strictEqual(e, reason);
322+
assert.strictEqual(reason, e);
323323
});
324324
});
325325

@@ -331,7 +331,7 @@ asyncTest('Catching a rejected promise derived from returning a' +
331331
Promise.resolve().then(function() {
332332
return Promise.reject(e);
333333
}).then(assert.fail, function(reason) {
334-
assert.strictEqual(e, reason);
334+
assert.strictEqual(reason, e);
335335
});
336336
});
337337

@@ -340,8 +340,8 @@ asyncTest('A rejected promise derived from returning an' +
340340
' does trigger unhandledRejection', function(done) {
341341
const e = new Error();
342342
onUnhandledSucceed(done, function(reason, promise) {
343-
assert.strictEqual(e, reason);
344-
assert.strictEqual(_promise, promise);
343+
assert.strictEqual(reason, e);
344+
assert.strictEqual(promise, _promise);
345345
});
346346
const _promise = Promise.resolve().then(function() {
347347
return new Promise(function(_, reject) {
@@ -356,8 +356,8 @@ asyncTest('A rejected promise derived from throwing in a fulfillment handler' +
356356
' does trigger unhandledRejection', function(done) {
357357
const e = new Error();
358358
onUnhandledSucceed(done, function(reason, promise) {
359-
assert.strictEqual(e, reason);
360-
assert.strictEqual(_promise, promise);
359+
assert.strictEqual(reason, e);
360+
assert.strictEqual(promise, _promise);
361361
});
362362
const _promise = Promise.resolve().then(function() {
363363
throw e;
@@ -370,8 +370,8 @@ asyncTest(
370370
function(done) {
371371
const e = new Error();
372372
onUnhandledSucceed(done, function(reason, promise) {
373-
assert.strictEqual(e, reason);
374-
assert.strictEqual(_promise, promise);
373+
assert.strictEqual(reason, e);
374+
assert.strictEqual(promise, _promise);
375375
});
376376
const _promise = Promise.resolve().then(function() {
377377
return Promise.reject(e);
@@ -410,8 +410,8 @@ asyncTest('Failing to catch the Promise.all() of a collection that includes' +
410410
' promise, not the passed promise', function(done) {
411411
const e = new Error();
412412
onUnhandledSucceed(done, function(reason, promise) {
413-
assert.strictEqual(e, reason);
414-
assert.strictEqual(p, promise);
413+
assert.strictEqual(reason, e);
414+
assert.strictEqual(promise, p);
415415
});
416416
const p = Promise.all([Promise.reject(e)]);
417417
});
@@ -422,13 +422,13 @@ asyncTest('Waiting setTimeout(, 10) to catch a promise causes an' +
422422
const unhandledPromises = [];
423423
const e = new Error();
424424
process.on('unhandledRejection', function(reason, promise) {
425-
assert.strictEqual(e, reason);
425+
assert.strictEqual(reason, e);
426426
unhandledPromises.push(promise);
427427
});
428428
process.on('rejectionHandled', function(promise) {
429-
assert.strictEqual(1, unhandledPromises.length);
429+
assert.strictEqual(unhandledPromises.length, 1);
430430
assert.strictEqual(unhandledPromises[0], promise);
431-
assert.strictEqual(thePromise, promise);
431+
assert.strictEqual(promise, thePromise);
432432
done();
433433
});
434434

@@ -437,7 +437,7 @@ asyncTest('Waiting setTimeout(, 10) to catch a promise causes an' +
437437
});
438438
setTimeout(function() {
439439
thePromise.then(assert.fail, function(reason) {
440-
assert.strictEqual(e, reason);
440+
assert.strictEqual(reason, e);
441441
});
442442
}, 10);
443443
});
@@ -568,8 +568,8 @@ asyncTest('setImmediate + promise microtasks is too late to attach a catch' +
568568
' (setImmediate before promise creation/rejection)', function(done) {
569569
const e = new Error();
570570
onUnhandledSucceed(done, function(reason, promise) {
571-
assert.strictEqual(e, reason);
572-
assert.strictEqual(p, promise);
571+
assert.strictEqual(reason, e);
572+
assert.strictEqual(promise, p);
573573
});
574574
const p = Promise.reject(e);
575575
setImmediate(function() {
@@ -583,8 +583,8 @@ asyncTest('setImmediate + promise microtasks is too late to attach a catch' +
583583
' handler; unhandledRejection will be triggered in that case' +
584584
' (setImmediate before promise creation/rejection)', function(done) {
585585
onUnhandledSucceed(done, function(reason, promise) {
586-
assert.strictEqual(undefined, reason);
587-
assert.strictEqual(p, promise);
586+
assert.strictEqual(reason, undefined);
587+
assert.strictEqual(promise, p);
588588
});
589589
setImmediate(function() {
590590
Promise.resolve().then(function() {
@@ -604,8 +604,8 @@ asyncTest('setImmediate + promise microtasks is too late to attach a catch' +
604604
' handler; unhandledRejection will be triggered in that case' +
605605
' (setImmediate after promise creation/rejection)', function(done) {
606606
onUnhandledSucceed(done, function(reason, promise) {
607-
assert.strictEqual(undefined, reason);
608-
assert.strictEqual(p, promise);
607+
assert.strictEqual(reason, undefined);
608+
assert.strictEqual(promise, p);
609609
});
610610
const p = Promise.reject();
611611
setImmediate(function() {
@@ -634,8 +634,8 @@ asyncTest(
634634
const e = new Error('error');
635635
const domainError = new Error('domain error');
636636
onUnhandledSucceed(done, function(reason, promise) {
637-
assert.strictEqual(reason, e);
638-
assert.strictEqual(domainReceivedError, domainError);
637+
assert.strictEqual(e, reason);
638+
assert.strictEqual(domainError, domainReceivedError);
639639
});
640640
Promise.reject(e);
641641
process.nextTick(function() {
@@ -670,7 +670,7 @@ asyncTest('Throwing an error inside a rejectionHandled handler goes to' +
670670
const e = new Error();
671671
const e2 = new Error();
672672
const tearDownException = setupException(function(err) {
673-
assert.strictEqual(e2, err);
673+
assert.strictEqual(err, e2);
674674
tearDownException();
675675
done();
676676
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.