Skip to content
Prev Previous commit
Next Next commit
tools: auto fix custom eslint rule for crypto-check.js
Adds "missing crypto" message in tests.

Refs : #16636
  • Loading branch information
shobhitchittora committed Feb 12, 2018
commit 1f52446e6a9a00b6f202cc8b89e5434e86520a05
10 changes: 5 additions & 5 deletions test/parallel/test-eslint-crypto-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ new RuleTester().run('crypto-check', rule, {
if (!common.hasCrypto) {
common.skip();
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.

Does this (and other occurences below) pass the test? I think the 'missing crypto' message is missing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added the string 'missing crypto' in tests. But there's still something wrong. Any help?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done now.

}
require('crypto');
require("crypto");
`
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.

Nit: unnecessary change.

],
invalid: [
Expand All @@ -25,19 +25,19 @@ new RuleTester().run('crypto-check', rule, {
errors: [{ message }],
output: `
if (!common.hasCrypto) {
common.skip();
common.skip("missing crypto");
}
require('crypto');
require("crypto");
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.

This can not be the proper output because there is no common imported in the code.

`
},
{
code: 'if (common.foo) {} require("crypto")',
errors: [{ message }],
output: `
if (!common.hasCrypto) {
common.skip();
common.skip("missing crypto");
}
require('crypto');
require("crypto");
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.

This can not be the expected output because common is not imported. But not only that, the first statement if (common.foo) {} was just removed? That is definitely not right.

`
}
]
Expand Down