diff --git a/test/fixtures/configured-bin.js b/test/fixtures/configured-bin.js deleted file mode 100755 index c68226ee7..000000000 --- a/test/fixtures/configured-bin.js +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node -var argv = require('./yargs/index.js') - .parserConfiguration({ 'dot-notation': true }) - .help('help') - .version() - .argv -console.log(argv) diff --git a/test/fixtures/no-extension b/test/fixtures/no-extension index 85c562007..9b2721f6b 100755 --- a/test/fixtures/no-extension +++ b/test/fixtures/no-extension @@ -4,4 +4,7 @@ var parser = require('../../yargs.js')(process.argv.slice(2)) -console.log(parser.argv) +console.log(parser.parserConfiguration({ + 'dot-notation': false, + 'boolean-negation': false +}).argv) diff --git a/test/fixtures/no-require-main.js b/test/fixtures/no-require-main.js index 3e46c8ba4..d415412cc 100755 --- a/test/fixtures/no-require-main.js +++ b/test/fixtures/no-require-main.js @@ -7,4 +7,7 @@ delete require.main var parser = require('../../yargs.js')(process.argv.slice(2), undefined, require) -console.log(parser.argv) +console.log(parser.parserConfiguration({ + 'dot-notation': false, + 'boolean-negation': false +}).argv) diff --git a/test/fixtures/normal-bin.js b/test/fixtures/normal-bin.js index 6ad4e38df..ae4d395ee 100755 --- a/test/fixtures/normal-bin.js +++ b/test/fixtures/normal-bin.js @@ -1,6 +1,10 @@ #!/usr/bin/env node -var argv = require('./yargs/index.js') +var argv = require('../../index.js') .help('help') .version() + .parserConfiguration({ + 'dot-notation': false, + 'boolean-negation': false + }) .argv console.log(argv) diff --git a/test/fixtures/package.json b/test/fixtures/package.json index 7927de4df..da11cd033 100644 --- a/test/fixtures/package.json +++ b/test/fixtures/package.json @@ -3,8 +3,7 @@ "repository": { "type": "svn" }, - "yargs": { - "dot-notation": false, - "boolean-negation": false + "blerg": { + "dot-notation": false } } diff --git a/test/fixtures/symlink-bin.js b/test/fixtures/symlink-bin.js index 14b7de118..e6ce6b934 100755 --- a/test/fixtures/symlink-bin.js +++ b/test/fixtures/symlink-bin.js @@ -2,5 +2,9 @@ var argv = require('./yargs-symlink/index.js') .help('help') .version() + .parserConfiguration({ + 'dot-notation': false, + 'boolean-negation': false + }) .argv console.log(argv) diff --git a/test/integration.js b/test/integration.js index dbe93e255..1f4d0b370 100644 --- a/test/integration.js +++ b/test/integration.js @@ -191,18 +191,6 @@ describe('integration tests', () => { return done() }) }) - - it('is overridden by yargs.parserConfiguration', (done) => { - testCmd('./configured-bin.js', [ '--foo.bar', '--no-baz' ], (code, stdout) => { - if (code) { - return done(new Error(`cmd exited with code ${code}`)) - } - - stdout.should.not.match(/foo\.bar/) - stdout.should.match(/noBaz/) - return done() - }) - }) }) after(() => { diff --git a/test/yargs.js b/test/yargs.js index 5ceb6f8e2..b5529f352 100644 --- a/test/yargs.js +++ b/test/yargs.js @@ -1678,7 +1678,7 @@ describe('yargs dsl tests', () => { it('allows an alternative cwd to be specified', () => { const argv = yargs('--foo a') - .pkgConf('yargs', './test/fixtures') + .pkgConf('blerg', './test/fixtures') .parse() argv.foo.should.equal('a') diff --git a/yargs.js b/yargs.js index 8280ae5aa..f2265bd9f 100644 --- a/yargs.js +++ b/yargs.js @@ -1,4 +1,5 @@ 'use strict' + const argsert = require('./lib/argsert') const fs = require('fs') const Command = require('./lib/command') @@ -603,7 +604,7 @@ function Yargs (processArgs, cwd, parentRequire) { const demand = opt.demand || opt.required || opt.require - // deprecated, use 'demandOption' instead + // A required option can be specified via "demand: true". if (demand) { self.demand(key, demand) } @@ -1032,13 +1033,6 @@ function Yargs (processArgs, cwd, parentRequire) { options.__ = y18n.__ options.configuration = self.getParserConfiguration() - // Deprecated - let pkgConfig = pkgUp()['yargs'] - if (pkgConfig) { - console.warn('Configuring yargs through package.json is deprecated and will be removed in a future major release, please use the JS API instead.') - options.configuration = Object.assign({}, pkgConfig, options.configuration) - } - const parsed = Parser.detailed(args, options) let argv = parsed.argv if (parseContext) argv = Object.assign({}, argv, parseContext)