Skip to content
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

Closed
wants to merge 5 commits into from

Conversation

Jeyanthinath
Copy link
Contributor

@Jeyanthinath Jeyanthinath commented May 2, 2017

…added score for sanbox object

First Pull request ...

In assert.throws changed the TypeError constructor to Regex .
Aslo added Scope for Sandbox Object

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label May 2, 2017
@mscdex mscdex added the vm Issues and PRs related to the vm subsystem. label May 2, 2017
@vsemozhetbyt
Copy link
Contributor

@@ -26,14 +26,16 @@ const vm = require('vm');

assert.throws(function() {
vm.isContext('string is not supported');
}, TypeError);
}, /TypeError/);
Copy link
Member

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$/?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did changed ! thanks

const sandbox = { foo: 'bar' };
vm.createContext(sandbox);
assert.strictEqual(vm.isContext(sandbox), true);
{
Copy link
Member

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.

Copy link
Contributor Author

@Jeyanthinath Jeyanthinath May 2, 2017

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 ?

Copy link
Member

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.

Copy link
Contributor

@mscdex mscdex May 2, 2017

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.

Copy link
Contributor Author

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

@mscdex
Copy link
Contributor

mscdex commented May 2, 2017

The commit messages should adhere to the commit guidelines.

assert.throws initally throws the TypeError constructor and now replacing that with regular expression
const sandbox = { foo: 'bar' };
vm.createContext(sandbox);
assert.strictEqual(vm.isContext(sandbox), true);
const sandbox = { foo: 'bar' };
Copy link
Member

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.

Copy link
Contributor Author

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
@lpinca
Copy link
Member

lpinca commented May 2, 2017

How about using something like this for commit message?

test: add regex check in test-vm-is-context

Use a regex to validate the error message.

Copy link
Member

@addaleax addaleax left a 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!

@lpinca
Copy link
Member

lpinca commented May 5, 2017

lpinca pushed a commit to lpinca/node that referenced this pull request May 5, 2017
Use a regex to validate the error message.

PR-URL: nodejs#12785
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
@lpinca
Copy link
Member

lpinca commented May 5, 2017

Landed in bc05436.

@lpinca lpinca closed this May 5, 2017
anchnk pushed a commit to anchnk/node that referenced this pull request May 6, 2017
Use a regex to validate the error message.

PR-URL: nodejs#12785
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
@jasnell jasnell mentioned this pull request May 11, 2017
@gibfahn gibfahn mentioned this pull request Jun 15, 2017
3 tasks
gibfahn pushed a commit that referenced this pull request Jun 18, 2017
Use a regex to validate the error message.

PR-URL: #12785
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
gibfahn pushed a commit that referenced this pull request Jun 20, 2017
Use a regex to validate the error message.

PR-URL: #12785
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Jul 11, 2017
Use a regex to validate the error message.

PR-URL: #12785
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Jul 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Issues and PRs related to the tests. vm Issues and PRs related to the vm subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants