-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
test-vm-is-context.js : changed the assert.thows object to regex and … #12785
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
Changes from 1 commit
2b788dd
6c199ca
96fe0d8
ade9260
3a52e21
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,14 +26,16 @@ const vm = require('vm'); | |
|
|
||
| assert.throws(function() { | ||
| vm.isContext('string is not supported'); | ||
| }, TypeError); | ||
| }, /TypeError/); | ||
|
|
||
| assert.strictEqual(vm.isContext({}), false); | ||
| assert.strictEqual(vm.isContext([]), false); | ||
|
|
||
| assert.strictEqual(vm.isContext(vm.createContext()), true); | ||
| assert.strictEqual(vm.isContext(vm.createContext([])), true); | ||
|
|
||
| const sandbox = { foo: 'bar' }; | ||
| vm.createContext(sandbox); | ||
| assert.strictEqual(vm.isContext(sandbox), true); | ||
| { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see no reasons to add this block.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 ?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might be useful if you want to reuse the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok , I will revoke it as of now |
||
| const sandbox = { foo: 'bar' }; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Jeyanthinath please revert also these white space changes.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oops , I missed those , thanks ! |
||
| 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.
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