Skip to content

Commit 39d8e44

Browse files
AdriVanHoudtMylesBorins
authored andcommitted
test: improve assert messages in repl-reset-event
PR-URL: #16836 Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 8383c34 commit 39d8e44

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

test/parallel/test-repl-reset-event.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ common.globalCheck = false;
2525

2626
const assert = require('assert');
2727
const repl = require('repl');
28+
const util = require('util');
2829

2930
// Create a dummy stream that does nothing
3031
const dummy = new common.ArrayStream();
@@ -38,11 +39,13 @@ function testReset(cb) {
3839
r.context.foo = 42;
3940
r.on('reset', common.mustCall(function(context) {
4041
assert(!!context, 'REPL did not emit a context with reset event');
41-
assert.strictEqual(context, r.context, 'REPL emitted incorrect context');
42+
assert.strictEqual(context, r.context, 'REPL emitted incorrect context. ' +
43+
`context is ${util.inspect(context)}, expected ${util.inspect(r.context)}`);
4244
assert.strictEqual(
4345
context.foo,
4446
undefined,
45-
'REPL emitted the previous context, and is not using global as context'
47+
'REPL emitted the previous context and is not using global as context. ' +
48+
`context.foo is ${context.foo}, expected undefined.`
4649
);
4750
context.foo = 42;
4851
cb();
@@ -61,7 +64,8 @@ function testResetGlobal() {
6164
assert.strictEqual(
6265
context.foo,
6366
42,
64-
'"foo" property is missing from REPL using global as context'
67+
'"foo" property is different from REPL using global as context. ' +
68+
`context.foo is ${context.foo}, expected 42.`
6569
);
6670
}));
6771
r.resetContext();

0 commit comments

Comments
 (0)