Skip to content

Commit

Permalink
Parse aliases and implications in config files
Browse files Browse the repository at this point in the history
This adds support for doing '100: true' in a .taprc or package.json file.
  • Loading branch information
isaacs committed May 20, 2019
1 parent 5b9982e commit fd50219
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 15 deletions.
10 changes: 2 additions & 8 deletions bin/run.js
Expand Up @@ -128,17 +128,11 @@ const main = async options => {

const rc = parseRcFile(options.rcfile)
debug('rc options', rc)
for (let i in rc) {
if (!options._.explicit.has(i))
options[i] = rc[i]
}
options._.update(rc)

const pj = parsePackageJson()
debug('package.json options', pj)
for (let i in pj) {
if (!options._.explicit.has(i))
options[i] = pj[i]
}
options._.update(pj)

// tell chalk if we want color or not.
if (!options.color)
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -33,7 +33,7 @@
"import-jsx": "^2.0.0",
"isexe": "^2.0.0",
"istanbul-lib-processinfo": "^1.0.0",
"jackspeak": "^1.3.8",
"jackspeak": "^1.4.0",
"minipass": "^2.3.5",
"mkdirp": "^0.5.1",
"nyc": "^14.1.0",
Expand Down
4 changes: 2 additions & 2 deletions tap-snapshots/test-run-dump-config.js-TAP.test.js
Expand Up @@ -151,7 +151,7 @@ bail: false
branches: 100
browser: true
changed: false
check-coverage: false
check-coverage: true
color: false
comments: false
coverage: false
Expand All @@ -165,7 +165,7 @@ help: false
invert: false
jobs: {number}
jsx: true
lines: 69
lines: 100
node-arg: []
nyc-arg: []
nyc-help: false
Expand Down
3 changes: 2 additions & 1 deletion test/run/dump-config.js
Expand Up @@ -36,7 +36,7 @@ t.test('package.json parsing', t => {
const cases = {
good: JSON.stringify({
tap: {
lines: 69,
100: true,
bail: true,
}
}),
Expand Down Expand Up @@ -91,6 +91,7 @@ t.test('good rc file', t => {
const rc = tmpfile(t, 'taprc', `
reporter: spec
jobs: 3
100: true
`)
run(['--dump-config', '-j4'], { env: {
TAP_RCFILE: rc,
Expand Down

0 comments on commit fd50219

Please sign in to comment.