-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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: add test for repl.defineCommand #3908
Conversation
This is awesome. CI: https://ci.nodejs.org/job/node-test-pull-request/776/ |
var stream = require('stream'), | ||
assert = require('assert'), | ||
repl = require('repl'); | ||
|
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.
For consistency, please use const
here.
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.
Sure no prob. I saw there was a lint error in CI so I'll fix that and this.
Should I const
everything in this file that can be? Or just the require
s?
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.
at least the requires for sure. make sure it passes lint. the rest I'd consider optional
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.
@bengl You can actually check everything locally simply by running make -j4 test
, here 4
denotes the number of tasks to be done parallelly.
One minor nit but LGTM if CI is green |
77a3e52
to
2ceb942
Compare
Cool. |
}); | ||
|
||
inputStream.write('.help\n'); | ||
assert(/\nsay1\thelp for say1\n/.test(output), 'help for say1 present'); |
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.
The second parameter will be thrown as an error, if the first param is not truthy. So the text should be negative I believe.
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.
Ah, sure. Will change those messages to be negative.
Awesome... doing another CI run just to be safe: https://ci.nodejs.org/job/node-test-pull-request/788/ |
It also tests displayPrompt by checking for '> '.
2ceb942
to
db28b50
Compare
Changed error messages to be negative. |
LGTM |
@jasnell looks like CI failed because I force-pushed a new version of it too early. Perhaps kick it off again? |
heh. Ok... new run: https://ci.nodejs.org/job/node-test-pull-request/790/ |
Looks like some unrelated failures in Windows and FreeBSD. |
Thanks! Landed in e5d97fd |
It also tests displayPrompt by checking for '> '. PR-URL: #3908 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
It also tests displayPrompt by checking for '> '. PR-URL: #3908 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
It also tests displayPrompt by checking for '> '. PR-URL: #3908 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
It also tests displayPrompt by checking for '> '. PR-URL: #3908 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
It also tests displayPrompt by checking for '> '. PR-URL: #3908 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
It also tests displayPrompt by checking for '> '. PR-URL: nodejs#3908 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
There didn't appear to be a test for
REPLServer#defineCommand
, probably because it wasn't documented before, so here's a test for it.