Skip to content

Commit

Permalink
upgrade deps
Browse files Browse the repository at this point in the history
  • Loading branch information
75lb committed Oct 10, 2016
1 parent 142ca6d commit 9c5c101
Show file tree
Hide file tree
Showing 22 changed files with 123 additions and 83 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ node_js:
- 4
- iojs
- 0.12
- 0.10
- '0.10'
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@
"author": "Lloyd Brookes <[email protected]>",
"license": "MIT",
"devDependencies": {
"babel-preset-es2015": "^6.9.0",
"core-assert": "~0.2.0",
"coveralls": "^2.11.12",
"jsdoc-to-markdown": "^1.3.6",
"test-runner": "~0.1.6",
"test-value": "^2.0.0"
"babel-preset-es2015": "^6.16.0",
"core-assert": "^0.2.1",
"coveralls": "^2.11.14",
"jsdoc-to-markdown": "^2.0.0",
"test-runner": "^0.2.5",
"test-value": "^2.1.0"
},
"dependencies": {
"array-back": "^1.0.3",
"core-js": "^2.4.1",
"feature-detect-es6": "^1.3.1",
"find-replace": "^1.0.2",
"typical": "^2.5.0"
"typical": "^2.6.0"
},
"standard": {
"ignore": [
Expand Down
10 changes: 6 additions & 4 deletions test/alias.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
'use strict'
var test = require('test-runner')
var TestRunner = require('test-runner')
var cliArgs = require('../')
var a = require('core-assert')

var runner = new TestRunner()

var optionDefinitions = [
{ name: 'verbose', alias: 'v' },
{ name: 'colour', alias: 'c' },
{ name: 'number', alias: 'n' },
{ name: 'dry-run', alias: 'd' }
]

test('alias: one boolean', function () {
runner.test('alias: one boolean', function () {
var argv = [ '-v' ]
a.deepStrictEqual(cliArgs(optionDefinitions, argv), {
verbose: true
})
})

test('alias: one --this-type boolean', function () {
runner.test('alias: one --this-type boolean', function () {
var argv = [ '-d' ]
a.deepStrictEqual(cliArgs(optionDefinitions, argv), {
'dry-run': true
})
})

test('alias: one boolean, one string', function () {
runner.test('alias: one boolean, one string', function () {
var argv = [ '-v', '-c' ]
a.deepStrictEqual(cliArgs(optionDefinitions, argv), {
verbose: true,
Expand Down
8 changes: 5 additions & 3 deletions test/bad-input.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
'use strict'
var test = require('test-runner')
var TestRunner = require('test-runner')
var cliArgs = require('../')
var a = require('core-assert')

test('bad-input: handles missing option value', function () {
var runner = new TestRunner()

runner.test('bad-input: handles missing option value', function () {
var optionDefinitions = [
{ name: 'colour', type: String },
{ name: 'files' }
Expand All @@ -17,7 +19,7 @@ test('bad-input: handles missing option value', function () {
})
})

test('bad-input: handles arrays with relative paths', function () {
runner.test('bad-input: handles arrays with relative paths', function () {
var optionDefinitions = [
{ name: 'colours', type: String, multiple: true }
]
Expand Down
12 changes: 7 additions & 5 deletions test/class-argv.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'
var test = require('test-runner')
var TestRunner = require('test-runner')
var detect = require('feature-detect-es6')
var a = require('core-assert')
var Argv
Expand All @@ -14,31 +14,33 @@ if (detect.all('class', 'arrowFunction', 'newArrayFeatures')) {
Definitions = require('../es5/definitions')
}

test('.expandOptionEqualsNotation()', function () {
var runner = new TestRunner()

runner.test('.expandOptionEqualsNotation()', function () {
var argv = new Argv([ '--one=1', '--two', '2', '--three=3', '4' ])
argv.expandOptionEqualsNotation()
a.deepStrictEqual(argv.list, [
'--one', '1', '--two', '2', '--three', '3', '4'
])
})

test('.expandGetoptNotation()', function () {
runner.test('.expandGetoptNotation()', function () {
var argv = new Argv([ '-abc' ])
argv.expandGetoptNotation()
a.deepStrictEqual(argv.list, [
'-a', '-b', '-c'
])
})

test('.expandGetoptNotation() with values', function () {
runner.test('.expandGetoptNotation() with values', function () {
var argv = new Argv([ '-abc', '1', '-a', '2', '-bc' ])
argv.expandGetoptNotation()
a.deepStrictEqual(argv.list, [
'-a', '-b', '-c', '1', '-a', '2', '-b', '-c'
])
})

test('.validate()', function () {
runner.test('.validate()', function () {
var definitions = new Definitions([
{ name: 'one', type: Number }
])
Expand Down
10 changes: 6 additions & 4 deletions test/class-definitions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'
var test = require('test-runner')
var TestRunner = require('test-runner')
var detect = require('feature-detect-es6')
var a = require('core-assert')
var Definitions
Expand All @@ -11,17 +11,19 @@ if (detect.all('class', 'arrowFunction', 'newArrayFeatures')) {
Definitions = require('../es5/definitions')
}

test('.createOutput()', function () {
var runner = new TestRunner()

runner.test('.createOutput()', function () {
var definitions = new Definitions([ { name: 'one', defaultValue: 'eins' } ])
a.deepStrictEqual(definitions.createOutput(), { one: 'eins' })
})

test('.get()', function () {
runner.test('.get()', function () {
var definitions = new Definitions([ { name: 'one', defaultValue: 'eins' } ])
a.strictEqual(definitions.get('--one').name, 'one')
})

test('.validate()', function () {
runner.test('.validate()', function () {
a.throws(function () {
var definitions = new Definitions([ { name: 'one' }, { name: 'one' } ])
})
Expand Down
16 changes: 9 additions & 7 deletions test/default-option.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
'use strict'
var test = require('test-runner')
var TestRunner = require('test-runner')
var cliArgs = require('../')
var a = require('core-assert')

test('defaultOption: string', function () {
var runner = new TestRunner()

runner.test('defaultOption: string', function () {
var optionDefinitions = [
{ name: 'files', defaultOption: true }
]
Expand All @@ -13,7 +15,7 @@ test('defaultOption: string', function () {
})
})

test('defaultOption: multiple string', function () {
runner.test('defaultOption: multiple string', function () {
var optionDefinitions = [
{ name: 'files', defaultOption: true, multiple: true }
]
Expand All @@ -23,7 +25,7 @@ test('defaultOption: multiple string', function () {
})
})

test('defaultOption: after a boolean', function () {
runner.test('defaultOption: after a boolean', function () {
var definitions = [
{ name: 'one', type: Boolean },
{ name: 'two', defaultOption: true }
Expand All @@ -34,7 +36,7 @@ test('defaultOption: after a boolean', function () {
)
})

test('defaultOption: multiple defaultOption values between other arg/value pairs', function () {
runner.test('defaultOption: multiple defaultOption values between other arg/value pairs', function () {
var optionDefinitions = [
{ name: 'one' },
{ name: 'two' },
Expand All @@ -48,7 +50,7 @@ test('defaultOption: multiple defaultOption values between other arg/value pairs
})
})

test('defaultOption: multiple defaultOption values between other arg/value pairs 2', function () {
runner.test('defaultOption: multiple defaultOption values between other arg/value pairs 2', function () {
var optionDefinitions = [
{ name: 'one', type: Boolean },
{ name: 'two' },
Expand All @@ -62,7 +64,7 @@ test('defaultOption: multiple defaultOption values between other arg/value pairs
})
})

test('defaultOption: floating args present but no defaultOption', function () {
runner.test('defaultOption: floating args present but no defaultOption', function () {
var definitions = [
{ name: 'one', type: Boolean }
]
Expand Down
12 changes: 7 additions & 5 deletions test/default-value.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
'use strict'
var test = require('test-runner')
var TestRunner = require('test-runner')
var cliArgs = require('../')
var a = require('core-assert')

test('default value', function () {
var runner = new TestRunner()

runner.test('default value', function () {
a.deepStrictEqual(cliArgs([ { name: 'one' }, { name: 'two', defaultValue: 'two' } ], [ '--one', '1' ]), {
one: '1',
two: 'two'
Expand All @@ -20,21 +22,21 @@ test('default value', function () {
)
})

test('default value', function () {
runner.test('default value 2', function () {
var defs = [{ name: 'two', multiple: true, defaultValue: ['two', 'zwei'] }]
var result = cliArgs(defs, [])
a.deepStrictEqual(result, { two: [ 'two', 'zwei' ] })
})

test('default value: array as defaultOption', function () {
runner.test('default value: array as defaultOption', function () {
var defs = [
{ name: 'two', multiple: true, defaultValue: ['two', 'zwei'], defaultOption: true }
]
var argv = [ 'duo' ]
a.deepStrictEqual(cliArgs(defs, argv), { two: [ 'duo' ] })
})

test('default value: falsy default values', function () {
runner.test('default value: falsy default values', function () {
var defs = [
{ name: 'one', defaultValue: 0 },
{ name: 'two', defaultValue: false }
Expand Down
8 changes: 5 additions & 3 deletions test/detect-process-argv.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
'use strict'
var test = require('test-runner')
var TestRunner = require('test-runner')
var cliArgs = require('../')
var a = require('core-assert')

test('detect process.argv: should automatically remove first two argv items', function () {
var runner = new TestRunner()

runner.test('detect process.argv: should automatically remove first two argv items', function () {
process.argv = [ 'node', 'filename', '--one', 'eins' ]
a.deepStrictEqual(cliArgs({ name: 'one' }, process.argv), {
one: 'eins'
})
})

test('process.argv is left untouched', function () {
runner.test('process.argv is left untouched', function () {
process.argv = [ 'node', 'filename', '--one', 'eins' ]
a.deepStrictEqual(cliArgs({ name: 'one' }), {
one: 'eins'
Expand Down
22 changes: 12 additions & 10 deletions test/exceptions.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
'use strict'
var test = require('test-runner')
var TestRunner = require('test-runner')
var cliArgs = require('../')
var a = require('core-assert')

test('err-invalid-definition: throws when no definition.name specified', function () {
var runner = new TestRunner()

runner.test('err-invalid-definition: throws when no definition.name specified', function () {
var optionDefinitions = [
{ something: 'one' },
{ something: 'two' }
Expand All @@ -17,7 +19,7 @@ test('err-invalid-definition: throws when no definition.name specified', functio
}
})

test('err-invalid-definition: throws if dev set a numeric alias', function () {
runner.test('err-invalid-definition: throws if dev set a numeric alias', function () {
var optionDefinitions = [
{ name: 'colours', alias: '1' }
]
Expand All @@ -31,7 +33,7 @@ test('err-invalid-definition: throws if dev set a numeric alias', function () {
}
})

test('err-invalid-definition: throws if dev set an alias of "-"', function () {
runner.test('err-invalid-definition: throws if dev set an alias of "-"', function () {
var optionDefinitions = [
{ name: 'colours', alias: '-' }
]
Expand All @@ -45,7 +47,7 @@ test('err-invalid-definition: throws if dev set an alias of "-"', function () {
}
})

test('err-invalid-definition: multi-character alias', function () {
runner.test('err-invalid-definition: multi-character alias', function () {
var optionDefinitions = [
{ name: 'one', alias: 'aa' }
]
Expand All @@ -59,7 +61,7 @@ test('err-invalid-definition: multi-character alias', function () {
}
})

test('err-invalid-definition: invalid type values', function () {
runner.test('err-invalid-definition: invalid type values', function () {
var argv = [ '--one', 'something' ]
try {
cliArgs([ { name: 'one', type: 'string' } ], argv)
Expand Down Expand Up @@ -87,7 +89,7 @@ test('err-invalid-definition: invalid type values', function () {
}, /invalid/i)
})

test('err-invalid-definition: value without option definition', function () {
runner.test('err-invalid-definition: value without option definition', function () {
var optionDefinitions = [
{ name: 'one', type: Number }
]
Expand Down Expand Up @@ -126,7 +128,7 @@ test('err-invalid-definition: value without option definition', function () {
}
})

test('err-invalid-definition: duplicate name', function () {
runner.test('err-invalid-definition: duplicate name', function () {
var optionDefinitions = [
{ name: 'colours' },
{ name: 'colours' }
Expand All @@ -141,7 +143,7 @@ test('err-invalid-definition: duplicate name', function () {
}
})

test('err-invalid-definition: duplicate alias', function () {
runner.test('err-invalid-definition: duplicate alias', function () {
var optionDefinitions = [
{ name: 'one', alias: 'a' },
{ name: 'two', alias: 'a' }
Expand All @@ -156,7 +158,7 @@ test('err-invalid-definition: duplicate alias', function () {
}
})

test('err-invalid-definition: multiple defaultOption', function () {
runner.test('err-invalid-definition: multiple defaultOption', function () {
var optionDefinitions = [
{ name: 'one', defaultOption: true },
{ name: 'two', defaultOption: true }
Expand Down
Loading

0 comments on commit 9c5c101

Please sign in to comment.