-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: clean up repl-reset-event file #9931
Conversation
', and is not using global as context'); | ||
assert.strictEqual(context, r.context, 'REPL emitted incorrect context'); | ||
assert.strictEqual(context.foo, undefined, 'REPL emitted the previous' + | ||
' context, and is not using global as context'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you line this up with the previous line.
Ping @courtnek: Thanks for the work on this! Can you make the change requested by @cjihrig and push it to this branch? If you want, you can copy/paste this into the file: 'use strict';
const common = require('../common');
common.globalCheck = false;
const assert = require('assert');
const repl = require('repl');
// Create a dummy stream that does nothing
const dummy = new common.ArrayStream();
function testReset(cb) {
const r = repl.start({
input: dummy,
output: dummy,
useGlobal: false
});
r.context.foo = 42;
r.on('reset', common.mustCall(function(context) {
assert(!!context, 'REPL did not emit a context with reset event');
assert.strictEqual(context, r.context, 'REPL emitted incorrect context');
assert.strictEqual(
context.foo,
undefined,
'REPL emitted the previous context, and is not using global as context'
);
context.foo = 42;
cb();
}));
r.resetContext();
}
function testResetGlobal() {
const r = repl.start({
input: dummy,
output: dummy,
useGlobal: true
});
r.context.foo = 42;
r.on('reset', common.mustCall(function(context) {
assert.strictEqual(
context.foo,
42,
'"foo" property is missing from REPL using global as context'
);
}));
r.resetContext();
}
testReset(common.mustCall(testResetGlobal)); |
* Change vars to let/const * Add mustCall * equal -> strictEqual * remove timeout
CI: https://ci.nodejs.org/job/node-test-pull-request/5519/ @cjihrig Looks like your comment has been addressed. Looks good to you now? |
CI is ✅ |
ping @cjihrig |
* Change vars to let/const * Add mustCall * equal -> strictEqual * remove timeout PR-URL: #9931 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Landed in e81e031 |
Thanks for the contribution, @courtnek! 🎉 |
* Change vars to let/const * Add mustCall * equal -> strictEqual * remove timeout PR-URL: #9931 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* Change vars to let/const * Add mustCall * equal -> strictEqual * remove timeout PR-URL: #9931 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* Change vars to let/const * Add mustCall * equal -> strictEqual * remove timeout PR-URL: #9931 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
* Change vars to let/const * Add mustCall * equal -> strictEqual * remove timeout PR-URL: #9931 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Checklist
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
Description of change