Skip to content

Commit

Permalink
Merge pull request #3 from dhershman1/dev
Browse files Browse the repository at this point in the history
Dev v0.3.0
  • Loading branch information
dhershman1 authored Aug 24, 2021
2 parents 2485a84 + e2ddd55 commit c4551f7
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 166 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## v0.3.0

### New

- New `disableColor` option so you can disable all color/style options besides the white space formatting

### Improved

- Respect bailouts when they come back in the results

### Fixed

- If tape errors out, the error should now bubble back to the terminal instead of getting consumed by tap-on

## v0.2.0

### Improved
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ If you need or want to use tap-on and it comes out ugle, or just flat out doesn'

- `-s, --stack`: This param will **hide** the stack trace in the fail messages you will still see the **at** however
- `-u, --summarize`: Enables failure summaries at the **END** of your test report, useful if you have a lot of tests!
- `-d, --disableColor`: Disables the styled output, and only keeps the icons, and spacing

## Installation

Expand Down
13 changes: 12 additions & 1 deletion bin/tap-on
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const parsedArgs = require('minimist')(process.argv.slice(2), {
alias: {
v: 'version',
s: 'stack',
u: 'summarize'
u: 'summarize',
d: 'disableColor'
}
})
const { version } = require('../package.json')
Expand All @@ -18,4 +19,14 @@ if (parsedArgs.version) {
process.stdin
.pipe(tapOn(parsedArgs))
.pipe(process.stdout)

process.on('exit', function (status) {
if (status === 1) {
process.exit(1)
}

if (tapOn.failed) {
process.exit(1)
}
})
}
12 changes: 11 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { bold, dim, underline, green, cyan, red } = require('colorette')
const { bold, cyan, dim, green, options, red, underline } = require('colorette')
const through = require('through2')
const duplexer = require('duplexer3')
const Parser = require('tap-parser')
Expand Down Expand Up @@ -43,12 +43,18 @@ function tapOn (args) {
let skippedTests = 0
let lastStr = ''

if (args.disableColor) {
options.enabled = false
}

tap.on('pass', assert => {
output.push(pad(`${green(symbols.tick)} ${dim(assert.name)}\n`, 4))
})

tap.on('fail', assert => {
output.push(formatFail(assert, args.stack))

stream.failed = true
})

tap.on('skip', assert => {
Expand Down Expand Up @@ -79,6 +85,10 @@ function tapOn (args) {
})

tap.on('complete', results => {
if ((results.count === 0 && results.skip === 0) || results.bailout) {
process.exit(1)
}

if (args.summarize) {
const failCount = results.failures.length
const [past, plural] = failCount === 1 ? ['was', 'failure'] : ['were', 'failures']
Expand Down
163 changes: 1 addition & 162 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "tap-on",
"version": "0.2.0",
"version": "0.3.0",
"description": "A nicer way to handle tap output",
"main": "index.js",
"scripts": {
"prepack": "npm run lint",
"test": "tape tests/pass.js | cross-env bin/tap-on",
"test:no:color": "tape tests/pass.js | cross-env bin/tap-on -d",
"lint": "standard index.js | snazzy"
},
"bin": {
Expand Down Expand Up @@ -41,7 +42,6 @@
},
"devDependencies": {
"cross-env": "7.0.3",
"npm-run-all": "4.1.5",
"snazzy": "9.0.0",
"standard": "16.0.3",
"tape": "5.3.1"
Expand Down

0 comments on commit c4551f7

Please sign in to comment.