To demonstrate the issue, notice the difference between the following:
$ node index.js
string
and
$ npm run test
number
[...]
| #!/usr/bin/env node | |
| console.log(typeof require('yargs')(['--arg', '123']).argv.arg); |
| { | |
| "name": "yargs-issue-config-search", | |
| "version": "1.0.0", | |
| "description": "Example of Yargs issue locating config under Mocha", | |
| "main": "index.js", | |
| "scripts": { | |
| "test": "mocha index.js" | |
| }, | |
| "devDependencies": { | |
| "mocha": "^3.2.0", | |
| "yargs": "^6.6.0" | |
| }, | |
| "yargs": { | |
| "parse-numbers": false | |
| } | |
| } |