Skip to content
Permalink
Browse files

Fix: Change max-warnings type to Int (fixes #4660)

Updated Optionator to version 0.8.0
Changed the type of the --max-warnings flag from 'Number' to 'Int'
An error will now be displayed if a non-integer value is supplied
  • Loading branch information...
gkz committed Dec 29, 2015
1 parent e8939e4 commit 315f27200a46f6dd018e6773220279c05eeb77a7
Showing with 9 additions and 3 deletions.
  1. +1 −1 docs/user-guide/command-line-interface.md
  2. +1 −1 lib/options.js
  3. +1 −1 package.json
  4. +6 −0 tests/lib/options.js
@@ -55,7 +55,7 @@ Using stdin:
Handling warnings:
--quiet Report errors only - default: false
--max-warnings Number Number of warnings to trigger nonzero exit code -
--max-warnings Int Number of warnings to trigger nonzero exit code -
default: -1
Output:
@@ -145,7 +145,7 @@ module.exports = optionator({
},
{
option: "max-warnings",
type: "Number",
type: "Int",
default: "-1",
description: "Number of warnings to trigger nonzero exit code"
},
@@ -61,7 +61,7 @@
"minimatch": "^3.0.0",
"mkdirp": "^0.5.0",
"object-assign": "^4.0.1",
"optionator": "^0.7.1",
"optionator": "^0.8.0",
"path-is-absolute": "^1.0.0",
"path-is-inside": "^1.0.1",
"shelljs": "^0.5.3",
@@ -266,6 +266,12 @@ describe("options", function() {
var currentOptions = options.parse("");
assert.equal(currentOptions.maxWarnings, -1);
});

it("should throw an error when supplied with a non-integer", function() {
assert.throws(function() {
options.parse("--max-warnings 10.2");
}, /Invalid value for option 'max-warnings' - expected type Int/);
});
});

describe("--init", function() {

0 comments on commit 315f272

Please sign in to comment.
You can’t perform that action at this time.