Skip to content
This repository has been archived by the owner on May 20, 2024. It is now read-only.

Update #4

Merged
merged 4 commits into from
Sep 2, 2018
Merged
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
5 changes: 4 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,10 @@ module.exports = function run (patterns, opts) {
output.emit('close-child', code)

if (code) {
if (!hadTests) lines.write(fail(`${name} exited with code ${code}`))
if (!hadTests || failed === 0) {
lines.write(fail(`${name} exited with code ${code}`))
}

if (opts.failFast) return output.end()
}

Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"lib"
],
"scripts": {
"prepublish": "npm t",
"check:missing": "dependency-check package.json lib/bin.js",
"check:unused": "dependency-check package.json lib/bin.js --unused --no-dev",
"test": "npm-run-all --silent check:* 1>&2 && tape test/*.js"
Expand All @@ -32,10 +31,10 @@
"xtend": "~4.0.1"
},
"devDependencies": {
"concat-stream": "~1.5.2",
"dependency-check": "~2.6.0",
"npm-run-all": "~3.1.1",
"tape": "~4.6.2"
"concat-stream": "~1.6.2",
"dependency-check": "~3.2.0",
"npm-run-all": "~4.1.3",
"tape": "~4.9.1"
},
"keywords": [
"test",
Expand Down
3 changes: 2 additions & 1 deletion test/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const test = require('tape')
, concat = require('concat-stream')
, fs = require('fs')
, path = require('path')
, removeStackTrace = require('./util/remove-stack-trace')
, multi = require('../')

test('passing', function (t) {
Expand Down Expand Up @@ -41,7 +42,7 @@ function run(tests, t) {

multi(tests.map(t => `${t}.js`), { basedir: __dirname + '/basic' })
.pipe(concat(function (output) {
t.equal(String(output).trim(), expected.trim())
t.equal(removeStackTrace(String(output)).trim(), expected.trim())
}))
}

Expand Down
7 changes: 4 additions & 3 deletions test/multiple-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const test = require('tape')
, execFile = require('child_process').execFile
, resolve = require('path').resolve
, concat = require('concat-stream')
, removeStackTrace = require('./util/remove-stack-trace')
, bin = resolve(__dirname, '..', 'lib', 'bin.js')
, cwd = resolve(__dirname, 'multiple-scripts')
, filename = resolve(cwd, 'test.js')
Expand Down Expand Up @@ -200,7 +201,7 @@ test('-r fail', function (t) {

// console.error('---\n' + stdout + '\n---')

t.is(stdout.trim(), wrap([
t.is(removeStackTrace(stdout.trim()), wrap([
'# name',
'ok 1 fail',
'not ok 2 fail',
Expand All @@ -226,7 +227,7 @@ test('-r test:a -r fail -r test:b', function (t) {

// console.error('---\n' + stdout + '\n---')

t.is(stdout.trim(), wrap([
t.is(removeStackTrace(stdout.trim()), wrap([
'# test:a › name',
'ok 1 test:a',
'# fail › name',
Expand Down Expand Up @@ -257,7 +258,7 @@ test('-r test:a -r fail -r test:b --fail-fast', function (t) {

// console.error('---\n' + stdout + '\n---')

t.is(stdout.trim(), wrap([
t.is(removeStackTrace(stdout.trim()), wrap([
'# test:a › name',
'ok 1 test:a',
'# fail › name',
Expand Down
5 changes: 5 additions & 0 deletions test/util/remove-stack-trace.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict'

module.exports = function (tapOutput) {
return tapOutput.replace(/ stack: \|-[\S\s]*\.\.\./, '...')
}