Skip to content

Commit f8a9dc7

Browse files
committed
Fix callbackify test on 0.12
1 parent a5a2f84 commit f8a9dc7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

test/node/callbackify.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ if (typeof Symbol !== 'undefined') {
7272
assert.strictEqual(err.message, 'Promise was rejected with a falsy value');
7373
assert.strictEqual(err.reason, value);
7474
} else {
75-
assert.strictEqual(String(value).endsWith(err.message), true);
75+
assert.strictEqual(String(value).slice(-err.message.length), err.message);
7676
}
7777
} else {
7878
assert.strictEqual(err, value);
@@ -97,7 +97,7 @@ if (typeof Symbol !== 'undefined') {
9797
assert.strictEqual(err.message, 'Promise was rejected with a falsy value');
9898
assert.strictEqual(err.reason, value);
9999
} else {
100-
assert.strictEqual(String(value).endsWith(err.message), true);
100+
assert.strictEqual(String(value).slice(-err.message.length), err.message);
101101
}
102102
} else {
103103
assert.strictEqual(err, value);

util.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,8 +691,8 @@ function callbackify(original) {
691691
// In true node style we process the callback on `nextTick` with all the
692692
// implications (stack, `uncaughtException`, `async_hooks`)
693693
original.apply(this, args)
694-
.then(function(ret) { process.nextTick(cb, null, ret) },
695-
function(rej) { process.nextTick(callbackifyOnRejected, rej, cb) });
694+
.then(function(ret) { process.nextTick(cb.bind(null, null, ret)) },
695+
function(rej) { process.nextTick(callbackifyOnRejected.bind(null, rej, cb)) });
696696
}
697697

698698
Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));

0 commit comments

Comments
 (0)