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 39d8e44

Browse filesBrowse files
AdriVanHoudtMylesBorins
authored andcommitted
test: improve assert messages in repl-reset-event
PR-URL: #16836 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 8383c34 commit 39d8e44
Copy full SHA for 39d8e44

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+7
-3
lines changed
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-repl-reset-event.js
+7-3Lines changed: 7 additions & 3 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.