-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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-vm-is-context.js : changed the assert.thows object to regex and … #12785
Conversation
…added score for sanbox object
test/parallel/test-vm-is-context.js
Outdated
@@ -26,14 +26,16 @@ const vm = require('vm'); | |||
|
|||
assert.throws(function() { | |||
vm.isContext('string is not supported'); | |||
}, TypeError); | |||
}, /TypeError/); |
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 please change this to: /^TypeError: sandbox must be an object$/
?
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.
I did changed ! thanks
test/parallel/test-vm-is-context.js
Outdated
const sandbox = { foo: 'bar' }; | ||
vm.createContext(sandbox); | ||
assert.strictEqual(vm.isContext(sandbox), true); | ||
{ |
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.
I see no reasons to add this block.
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.
I thought it would restrict the access of sandbox variable. @lpinca any suggestion ?
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.
It might be useful if you want to reuse the sandbox
variable in another scope but currently there is no need for it.
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.
I don't think it really matters either way, but I personally would probably opt to just wait until someone adds another test below it that also uses variables.
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.
ok , I will revoke it as of now
The commit messages should adhere to the commit guidelines. |
assert.throws initally throws the TypeError constructor and now replacing that with regular expression
test/parallel/test-vm-is-context.js
Outdated
const sandbox = { foo: 'bar' }; | ||
vm.createContext(sandbox); | ||
assert.strictEqual(vm.isContext(sandbox), true); | ||
const sandbox = { foo: 'bar' }; |
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.
@Jeyanthinath please revert also these white space changes.
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.
oops , I missed those , thanks !
assert.throws initally throws the TypeError constructor and now replacing that with regular expression
How about using something like this for commit message?
|
Use a regex to validate the error message.
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.
LGTM, thank you for fixing this!
Use a regex to validate the error message. PR-URL: nodejs#12785 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
Landed in bc05436. |
Use a regex to validate the error message. PR-URL: nodejs#12785 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
Use a regex to validate the error message. PR-URL: #12785 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
Use a regex to validate the error message. PR-URL: #12785 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
Use a regex to validate the error message. PR-URL: #12785 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
…added score for sanbox object
First Pull request ...
In assert.throws changed the TypeError constructor to Regex .
Aslo added Scope for Sandbox Object