Skip to content

Commit

Permalink
test: simplify coverage enforcement (#1578)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe committed Mar 8, 2020
1 parent 3af7f04 commit b7722a6
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/ci.yaml
Expand Up @@ -33,10 +33,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12
node-version: 13
- run: npm install
- run: npm test
- run: npm run coverage
env:
COVERALLS_REPO_TOKEN: "${{ secrets.COVERALLS_REPO_TOKEN }}"
COVERALLS_GIT_BRANCH: "${{ github.ref }}"
3 changes: 0 additions & 3 deletions README.md
Expand Up @@ -9,7 +9,6 @@
<br>

[![Build Status][travis-image]][travis-url]
[![Coverage Status][coveralls-image]][coveralls-url]
[![NPM version][npm-image]][npm-url]
[![js-standard-style][standard-image]][standard-url]
[![Conventional Commits][conventional-commits-image]][conventional-commits-url]
Expand Down Expand Up @@ -127,8 +126,6 @@ Having problems? want to contribute? join our [community slack](http://devtoolsc

[travis-url]: https://travis-ci.org/yargs/yargs
[travis-image]: https://img.shields.io/travis/yargs/yargs/master.svg
[coveralls-url]: https://coveralls.io/github/yargs/yargs
[coveralls-image]: https://img.shields.io/coveralls/yargs/yargs.svg
[npm-url]: https://www.npmjs.com/package/yargs
[npm-image]: https://img.shields.io/npm/v/yargs.svg
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
Expand Down
2 changes: 2 additions & 0 deletions lib/usage.js
Expand Up @@ -500,6 +500,8 @@ module.exports = function usage (yargs, y18n) {
// guess the width of the console window, max-width 80.
function windowWidth () {
const maxWidth = 80
// CI is not a TTY
/* c8 ignore next 2 */
if (typeof process === 'object' && process.stdout && process.stdout.columns) {
return Math.min(maxWidth, process.stdout.columns)
} else {
Expand Down
3 changes: 1 addition & 2 deletions package.json
Expand Up @@ -35,7 +35,6 @@
"c8": "^7.0.0",
"chai": "^4.2.0",
"chalk": "^3.0.0",
"coveralls": "^3.0.3",
"cpr": "^3.0.1",
"cross-spawn": "^7.0.0",
"es6-promise": "^4.2.5",
Expand All @@ -50,7 +49,7 @@
"fix": "standard --fix",
"posttest": "standard",
"test": "c8 --reporter=html --reporter=text mocha --require ./test/before.js --timeout=12000 --check-leaks",
"coverage": "c8 report --reporter=text-lcov | coveralls"
"coverage": "c8 report --check-coverage check-coverage --lines=100 --branches=96 --statements=100"
},
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions test/yargs.js
Expand Up @@ -580,11 +580,11 @@ describe('yargs dsl tests', () => {

describe('terminalWidth', () => {
it('returns the maximum width of the terminal', function () {
if (!process.stdout.isTTY) {
return this.skip()
if (process.stdout.isTTY) {
yargs.terminalWidth().should.be.gte(0)
} else {
expect(yargs.terminalWidth()).to.equal(null)
}

yargs.terminalWidth().should.be.gte(0)
})
})

Expand Down

0 comments on commit b7722a6

Please sign in to comment.