Skip to content

Commit a50366f

Browse files
AdriVanHoudtgibfahn
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 bd4b97f commit a50366f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ common.globalCheck = false;
44

55
const assert = require('assert');
66
const repl = require('repl');
7+
const util = require('util');
78

89
// Create a dummy stream that does nothing
910
const dummy = new common.ArrayStream();
@@ -17,11 +18,13 @@ function testReset(cb) {
1718
r.context.foo = 42;
1819
r.on('reset', common.mustCall(function(context) {
1920
assert(!!context, 'REPL did not emit a context with reset event');
20-
assert.strictEqual(context, r.context, 'REPL emitted incorrect context');
21+
assert.strictEqual(context, r.context, 'REPL emitted incorrect context. ' +
22+
`context is ${util.inspect(context)}, expected ${util.inspect(r.context)}`);
2123
assert.strictEqual(
2224
context.foo,
2325
undefined,
24-
'REPL emitted the previous context, and is not using global as context'
26+
'REPL emitted the previous context and is not using global as context. ' +
27+
`context.foo is ${context.foo}, expected undefined.`
2528
);
2629
context.foo = 42;
2730
cb();
@@ -40,7 +43,8 @@ function testResetGlobal() {
4043
assert.strictEqual(
4144
context.foo,
4245
42,
43-
'"foo" property is missing from REPL using global as context'
46+
'"foo" property is different from REPL using global as context. ' +
47+
`context.foo is ${context.foo}, expected 42.`
4448
);
4549
}));
4650
r.resetContext();

0 commit comments

Comments
 (0)