Skip to content

test-vm-is-context.js : changed the assert.thows object to regex and … - #12785

Closed
Jeyanthinath wants to merge 5 commits into
nodejs:masterfrom
Jeyanthinath:master
Closed

test-vm-is-context.js : changed the assert.thows object to regex and …#12785
Jeyanthinath wants to merge 5 commits into
nodejs:masterfrom
Jeyanthinath:master

Conversation

@Jeyanthinath

@JeyanthinathJeyanthinath commented May 2, 2017

Copy link
Copy Markdown
Contributor

…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-botnodejs-github-bot added the test Issues and PRs related to the tests. label May 2, 2017
@mscdexmscdex added the vm Issues and PRs related to the vm subsystem. label May 2, 2017
@vsemozhetbyt

Copy link
Copy Markdown
Contributor

Comment threadtest/parallel/test-vm-is-context.js Outdated
assert.throws(function() {
vm.isContext('string is not supported');
}, TypeError);
}, /TypeError/);

Copy link
Copy Markdown
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
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I did changed ! thanks

Comment threadtest/parallel/test-vm-is-context.js Outdated
const sandbox = { foo: 'bar' };
vm.createContext(sandbox);
assert.strictEqual(vm.isContext(sandbox), true);
{

Copy link
Copy Markdown
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.

@JeyanthinathJeyanthinathMay 2, 2017

Copy link
Copy Markdown
ContributorAuthor

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
Copy Markdown
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.

@mscdexmscdexMay 2, 2017

Copy link
Copy Markdown
Contributor

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
Copy Markdown
ContributorAuthor

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
Copy Markdown
Contributor

The commit messages should adhere to the commit guidelines.

assert.throws initally throws the TypeError constructor and now replacing that with regular expression
Comment threadtest/parallel/test-vm-is-context.js Outdated
const sandbox = { foo: 'bar' };
vm.createContext(sandbox);
assert.strictEqual(vm.isContext(sandbox), true);
const sandbox = { foo: 'bar' };

Copy link
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
Member

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.

@addaleaxaddaleax left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
Member

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
Copy Markdown
Member

Landed in bc05436.

@lpincalpinca 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>
@jasnelljasnell mentioned this pull request May 11, 2017
@gibfahngibfahn 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>
@MylesBorinsMylesBorins mentioned this pull request Jul 18, 2017
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testIssues and PRs related to the tests.vmIssues and PRs related to the vm subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@Jeyanthinath@vsemozhetbyt@mscdex@lpinca@jasnell@addaleax@cjihrig@gibfahn@nodejs-github-bot