Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
passing
  • Loading branch information
JaKXz committed Feb 21, 2019
commit 38a5f16c393bcef1c72af04ec6d8baae7f60da35
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test/snapshots/*
package*.json
CHANGELOG.md
3 changes: 3 additions & 0 deletions ava.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
files: ['test/**/*.test.js']
}
4,114 changes: 3,889 additions & 225 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"url": "[email protected]:bcoe/c8.git"
},
"scripts": {
"test": "node ./bin/c8.js --reporter=html --reporter=text mocha --timeout=4000 ./test/*.js",
"test:snap": "CHAI_JEST_SNAPSHOT_UPDATE_ALL=true npm test",
"test": "node ./bin/c8.js --include lib --reporter=html --reporter=text ava",
"test:snap": "ava -u",
"posttest": "standard",
"coverage": "./bin/c8.js report --reporter=text-lcov | coveralls",
"release": "standard-version"
Expand Down Expand Up @@ -47,10 +47,10 @@
"yargs-parser": "^10.1.0"
},
"devDependencies": {
"chai": "^4.1.2",
"chai-jest-snapshot": "^2.0.0",
"ava": "^1.2.1",
"await-spawn": "^2.1.2",
"coveralls": "^3.0.2",
"mocha": "^5.2.0",
"prettier": "^1.16.4",
"standard": "^12.0.1",
"standard-version": "^4.4.0"
},
Expand All @@ -61,5 +61,9 @@
"lib",
"bin",
"LICENSE"
]
],
"prettier": {
"singleQuote": true,
"semi": false
}
}
56 changes: 56 additions & 0 deletions test/check-coverage.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import test from 'ava'
import spawn from 'await-spawn'

const nodePath = process.execPath
const c8Path = require.resolve('../bin/c8')

test('exits with 0 if coverage within threshold', async t => {
const output = await spawn(nodePath, [
c8Path,
'check-coverage',
'--exclude="test/*.js"',
'--lines=70'
])

t.snapshot(output.toString('utf8'))
})

test('allows threshold to be applied on a per-file basis', t => {
return spawn(nodePath, [
c8Path,
'check-coverage',
'--exclude="test/*.js"',
'--lines=80',
'--per-file'
]).catch(({ code, stderr }) => {
t.is(code, 1)
t.snapshot(stderr.toString('utf8'))
})
})

test('exits with 1 if coverage is below threshold', t => {
return spawn(nodePath, [
c8Path,
'check-coverage',
'--exclude="test/*.js"',
'--lines=101'
]).catch(({ code, stderr }) => {
t.is(code, 1)
t.snapshot(stderr.toString('utf8'))
})
})

test('allows --check-coverage when executing script', t => {
return spawn(nodePath, [
c8Path,
'--exclude="test/*.js"',
'--clean=false',
'--lines=101',
'--check-coverage',
nodePath,
require.resolve('./fixtures/normal')
]).catch(({ code, stderr }) => {
t.is(code, 1)
t.snapshot(stderr.toString('utf8'))
})
})
125 changes: 0 additions & 125 deletions test/integration.js

This file was deleted.

135 changes: 0 additions & 135 deletions test/integration.js.snap

This file was deleted.

Loading