Skip to content

Commit

Permalink
build: use .c8rc for configuration (#214)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe committed Apr 30, 2020
1 parent 8797ac4 commit e9602bf
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .c8rc
@@ -0,0 +1,9 @@
{
"reporter": [
"html",
"text"
],
"lines": 96,
"branches": "82",
"statements": "96"
}
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -10,7 +10,7 @@
"url": "git@github.com:bcoe/c8.git"
},
"scripts": {
"test": "node ./bin/c8.js --reporter=html --reporter=text mocha --timeout=8000 ./test/*.js",
"test": "node ./bin/c8.js mocha --timeout=8000 ./test/*.js",
"test:snap": "CHAI_JEST_SNAPSHOT_UPDATE_ALL=true npm test",
"fix": "standard --fix",
"posttest": "standard",
Expand Down
4 changes: 3 additions & 1 deletion test/integration.js
Expand Up @@ -104,7 +104,9 @@ describe('c8', () => {
'check-coverage',
'--exclude="test/*.js"',
'--temp-directory=tmp/check-coverage',
'--lines=80'
'--lines=80',
'--branches=80',
'--statements=80'
])
status.should.equal(0)
output.toString('utf8').should.matchSnapshot()
Expand Down
9 changes: 9 additions & 0 deletions test/integration.js.snap
Expand Up @@ -80,11 +80,15 @@ All files | 64.29 | 66.67 | 50 | 64.29 |
unloaded.js | 0 | 0 | 0 | 0 | 1-5
--------------|---------|----------|---------|---------|-------------------
,ERROR: Coverage for lines (64.29%) does not meet global threshold (100%)
ERROR: Coverage for branches (66.67%) does not meet global threshold (82%)
ERROR: Coverage for statements (64.29%) does not meet global threshold (96%)
"
`;

exports[`c8 --all should allow for --all to be used with the check-coverage command (2 invocations) 1`] = `
",,ERROR: Coverage for lines (64.29%) does not meet global threshold (90%)
ERROR: Coverage for branches (66.67%) does not meet global threshold (82%)
ERROR: Coverage for statements (64.29%) does not meet global threshold (96%)
"
`;

Expand Down Expand Up @@ -118,19 +122,23 @@ All files | 83.33 | 85.71 | 60 | 83.33 |
normal.js | 75 | 66.67 | 33.33 | 75 | 14-16,18-20
-----------|---------|----------|---------|---------|-------------------
,ERROR: Coverage for lines (83.33%) does not meet global threshold (101%)
ERROR: Coverage for statements (83.33%) does not meet global threshold (96%)
"
`;

exports[`c8 check-coverage allows threshold to be applied on per-file basis 1`] = `
",,ERROR: Coverage for lines (100%) does not meet threshold (101%) for test/fixtures/async.js
ERROR: Coverage for lines (75%) does not meet threshold (101%) for test/fixtures/normal.js
ERROR: Coverage for branches (66.67%) does not meet threshold (82%) for test/fixtures/normal.js
ERROR: Coverage for statements (75%) does not meet threshold (96%) for test/fixtures/normal.js
"
`;

exports[`c8 check-coverage exits with 0 if coverage within threshold 1`] = `",,"`;

exports[`c8 check-coverage exits with 1 if coverage is below threshold 1`] = `
",,ERROR: Coverage for lines (83.33%) does not meet global threshold (101%)
ERROR: Coverage for statements (83.33%) does not meet global threshold (96%)
"
`;

Expand Down Expand Up @@ -218,6 +226,7 @@ All files | 83.33 | 85.71 | 60 | 83.33 |
normal.js | 75 | 66.67 | 33.33 | 75 | 14-16,18-20
-----------|---------|----------|---------|---------|-------------------
,ERROR: Coverage for lines (83.33%) does not meet global threshold (101%)
ERROR: Coverage for statements (83.33%) does not meet global threshold (96%)
"
`;
Expand Down

0 comments on commit e9602bf

Please sign in to comment.