From 775ba3789e16b1464dc810243dc5866b2868fc1d Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Mon, 24 Jan 2022 10:10:10 -0800 Subject: [PATCH 01/11] Revert "[Tests] handle a broken error `cause` in node 16.9/16.10" This reverts commit 53d9e18a93addb2bf70c33cc4ffe8285233a3ad0, plus a little extra. --- test/error.js | 2 +- test/stackTrace.js | 8 +++----- test/throws.js | 20 +++++++++----------- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/test/error.js b/test/error.js index 94c96ed9..18dcb0bd 100644 --- a/test/error.js +++ b/test/error.js @@ -20,7 +20,7 @@ tap.test('failures', function (tt) { ' expected: |-', ' undefined', ' actual: |-', - ' ' + ('cause' in Error.prototype ? '{ [Error: this is a message] [cause]: undefined }' : '[Error: this is a message]'), + ' [Error: this is a message]', ' at: Test. ($TEST/error.js:$LINE:$COL)', ' stack: |-', ' Error: this is a message', diff --git a/test/stackTrace.js b/test/stackTrace.js index 6061f9ca..8ae0ee6b 100644 --- a/test/stackTrace.js +++ b/test/stackTrace.js @@ -14,8 +14,6 @@ tap.test('preserves stack trace with newlines', function (tt) { var parser = stream.pipe(tapParser()); var stackTrace = 'foo\n bar'; - var inspected = 'cause' in Error.prototype ? '{ [Error: Preserve stack] [cause]: undefined }' : '[Error: Preserve stack]'; - parser.once('assert', function (data) { delete data.diag.at; tt.deepEqual(data, { @@ -26,7 +24,7 @@ tap.test('preserves stack trace with newlines', function (tt) { stack: stackTrace, operator: 'error', expected: 'undefined', - actual: inspected + actual: '[Error: Preserve stack]' } }); }); @@ -43,7 +41,7 @@ tap.test('preserves stack trace with newlines', function (tt) { + ' expected: |-\n' + ' undefined\n' + ' actual: |-\n' - + ' ' + inspected + '\n' + + ' [Error: Preserve stack]\n' + ' stack: |-\n' + ' foo\n' + ' bar\n' @@ -59,7 +57,7 @@ tap.test('preserves stack trace with newlines', function (tt) { stack: stackTrace, operator: 'error', expected: 'undefined', - actual: inspected + actual: '[Error: Preserve stack]' }); })); diff --git a/test/throws.js b/test/throws.js index a2daf100..a683bfcf 100644 --- a/test/throws.js +++ b/test/throws.js @@ -26,8 +26,6 @@ var thrower = function () { throw messageGetterError; }; tap.test('failures', function (tt) { tt.plan(1); - var maybeCause = 'cause' in Error.prototype ? '[cause]: undefined, ' : ''; - var test = tape.createHarness(); test.createStream().pipe(concat(function (body) { tt.same(stripFullStack(body.toString('utf8')), [ @@ -39,7 +37,7 @@ tap.test('failures', function (tt) { ' expected: |-', ' undefined', ' actual: |-', - ' { [TypeError: ' + getNonFunctionMessage() + '] ' + maybeCause + "message: '" + getNonFunctionMessage() + "' }", + ' { [TypeError: ' + getNonFunctionMessage() + "] message: '" + getNonFunctionMessage() + "' }", ' at: Test. ($TEST/throws.js:$LINE:$COL)', ' stack: |-', String(' TypeError: ' + getNonFunctionMessage(undefined)), @@ -53,7 +51,7 @@ tap.test('failures', function (tt) { ' expected: |-', ' undefined', ' actual: |-', - ' { [TypeError: ' + getNonFunctionMessage(null) + '] ' + maybeCause + "message: '" + getNonFunctionMessage(null) + "' }", + ' { [TypeError: ' + getNonFunctionMessage(null) + "] message: '" + getNonFunctionMessage(null) + "' }", ' at: Test. ($TEST/throws.js:$LINE:$COL)', ' stack: |-', String(' TypeError: ' + getNonFunctionMessage(null)), @@ -67,7 +65,7 @@ tap.test('failures', function (tt) { ' expected: |-', ' undefined', ' actual: |-', - ' { [TypeError: ' + getNonFunctionMessage(true) + '] ' + maybeCause + "message: '" + getNonFunctionMessage(true) + "' }", + ' { [TypeError: ' + getNonFunctionMessage(true) + "] message: '" + getNonFunctionMessage(true) + "' }", ' at: Test. ($TEST/throws.js:$LINE:$COL)', ' stack: |-', String(' TypeError: ' + getNonFunctionMessage(true)), @@ -81,7 +79,7 @@ tap.test('failures', function (tt) { ' expected: |-', ' undefined', ' actual: |-', - ' { [TypeError: ' + getNonFunctionMessage(false) + '] ' + maybeCause + "message: '" + getNonFunctionMessage(false) + "' }", + ' { [TypeError: ' + getNonFunctionMessage(false) + "] message: '" + getNonFunctionMessage(false) + "' }", ' at: Test. ($TEST/throws.js:$LINE:$COL)', ' stack: |-', String(' TypeError: ' + getNonFunctionMessage(false)), @@ -95,7 +93,7 @@ tap.test('failures', function (tt) { ' expected: |-', ' undefined', ' actual: |-', - ' { [TypeError: ' + getNonFunctionMessage('abc') + '] ' + maybeCause + "message: '" + getNonFunctionMessage('abc') + "' }", + ' { [TypeError: ' + getNonFunctionMessage('abc') + "] message: '" + getNonFunctionMessage('abc') + "' }", ' at: Test. ($TEST/throws.js:$LINE:$COL)', ' stack: |-', String(' TypeError: ' + getNonFunctionMessage('abc')), @@ -109,7 +107,7 @@ tap.test('failures', function (tt) { ' expected: |-', ' undefined', ' actual: |-', - ' { [TypeError: ' + getNonFunctionMessage(/a/g) + '] ' + maybeCause + "message: '" + getNonFunctionMessage(/a/g) + "' }", + ' { [TypeError: ' + getNonFunctionMessage(/a/g) + "] message: '" + getNonFunctionMessage(/a/g) + "' }", ' at: Test. ($TEST/throws.js:$LINE:$COL)', ' stack: |-', String(' TypeError: ' + getNonFunctionMessage(/a/g)), @@ -123,7 +121,7 @@ tap.test('failures', function (tt) { ' expected: |-', ' undefined', ' actual: |-', - ' { [TypeError: ' + getNonFunctionMessage([]) + '] ' + maybeCause + "message: '" + getNonFunctionMessage([]) + "' }", + ' { [TypeError: ' + getNonFunctionMessage([]) + "] message: '" + getNonFunctionMessage([]) + "' }", ' at: Test. ($TEST/throws.js:$LINE:$COL)', ' stack: |-', String(' TypeError: ' + getNonFunctionMessage([])), @@ -137,7 +135,7 @@ tap.test('failures', function (tt) { ' expected: |-', ' undefined', ' actual: |-', - ' { [TypeError: ' + getNonFunctionMessage({}) + '] ' + maybeCause + "message: '" + getNonFunctionMessage({}) + "' }", + ' { [TypeError: ' + getNonFunctionMessage({}) + "] message: '" + getNonFunctionMessage({}) + "' }", ' at: Test. ($TEST/throws.js:$LINE:$COL)', ' stack: |-', String(' TypeError: ' + getNonFunctionMessage({})), @@ -171,7 +169,7 @@ tap.test('failures', function (tt) { ' expected: |-', ' [Function: TypeError]', ' actual: |-', - ' { [RangeError: actual!] ' + maybeCause + "message: 'actual!' }", + " { [RangeError: actual!] message: 'actual!' }", ' at: Test. ($TEST/throws.js:$LINE:$COL)', ' stack: |-', ' RangeError: actual!', From 20ea48d53b6492bf648d02d53c41b324abbfb6e1 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sat, 17 Sep 2022 20:38:47 -0700 Subject: [PATCH 02/11] [readme] fix version badge --- readme.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.markdown b/readme.markdown index 03fe7e14..ab698d56 100644 --- a/readme.markdown +++ b/readme.markdown @@ -1,4 +1,4 @@ -# tape [![Version Badge][npm-version-svg][package-url]] +# tape [![Version Badge][npm-version-svg]][package-url] tap-producing test harness for node and browsers From 85d86a468af1b74af432d41c204efd4440b5f56f Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sat, 17 Sep 2022 20:40:54 -0700 Subject: [PATCH 03/11] [meta] fix repo URLs --- package.json | 10 +++++----- readme.markdown | 28 ++++++++++++++-------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index baf08198..1c4e3f5b 100644 --- a/package.json +++ b/package.json @@ -72,9 +72,9 @@ }, "repository": { "type": "git", - "url": "git://github.com/substack/tape.git" + "url": "git://github.com/ljharb/tape.git" }, - "homepage": "https://github.com/substack/tape", + "homepage": "https://github.com/ljharb/tape", "keywords": [ "tap", "test", @@ -83,9 +83,9 @@ "browser" ], "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" }, "license": "MIT" } diff --git a/readme.markdown b/readme.markdown index ab698d56..22ad29e8 100644 --- a/readme.markdown +++ b/readme.markdown @@ -98,7 +98,7 @@ If you want a more colorful / pretty output there are lots of modules on npm tha - [tap-spec](https://github.com/scottcorgan/tap-spec) - [tap-dot](https://github.com/scottcorgan/tap-dot) -- [faucet](https://github.com/substack/faucet) +- [faucet](https://github.com/ljharb/faucet) - [tap-bail](https://github.com/juliangruber/tap-bail) - [tap-browser-color](https://github.com/kirbysayshi/tap-browser-color) - [tap-json](https://github.com/gummesson/tap-json) @@ -277,13 +277,13 @@ Aliases: `t.notEquals()`, `t.notStrictEqual()`, `t.notStrictEquals()`, ## t.deepEqual(actual, expected, msg) -Assert that `actual` and `expected` have the same structure and nested values using [node's deepEqual() algorithm](https://github.com/substack/node-deep-equal) with strict comparisons (`===`) on leaf nodes and an optional description of the assertion `msg`. +Assert that `actual` and `expected` have the same structure and nested values using [node's deepEqual() algorithm](https://github.com/inspect-js/node-deep-equal) with strict comparisons (`===`) on leaf nodes and an optional description of the assertion `msg`. Aliases: `t.deepEquals()`, `t.isEquivalent()`, `t.same()` ## t.notDeepEqual(actual, expected, msg) -Assert that `actual` and `expected` do not have the same structure and nested values using [node's deepEqual() algorithm](https://github.com/substack/node-deep-equal) with strict comparisons (`===`) on leaf nodes and an optional description of the assertion `msg`. +Assert that `actual` and `expected` do not have the same structure and nested values using [node's deepEqual() algorithm](https://github.com/inspect-js/node-deep-equal) with strict comparisons (`===`) on leaf nodes and an optional description of the assertion `msg`. Aliases: `t.notDeepEquals`, `t.notEquivalent()`, `t.notDeeply()`, `t.notSame()`, `t.isNotDeepEqual()`, `t.isNotDeeply()`, `t.isNotEquivalent()`, @@ -291,13 +291,13 @@ Aliases: `t.notDeepEquals`, `t.notEquivalent()`, `t.notDeeply()`, `t.notSame()`, ## t.deepLooseEqual(actual, expected, msg) -Assert that `actual` and `expected` have the same structure and nested values using [node's deepEqual() algorithm](https://github.com/substack/node-deep-equal) with loose comparisons (`==`) on leaf nodes and an optional description of the assertion `msg`. +Assert that `actual` and `expected` have the same structure and nested values using [node's deepEqual() algorithm](https://github.com/inspect-js/node-deep-equal) with loose comparisons (`==`) on leaf nodes and an optional description of the assertion `msg`. Aliases: `t.looseEqual()`, `t.looseEquals()` ## t.notDeepLooseEqual(actual, expected, msg) -Assert that `actual` and `expected` do not have the same structure and nested values using [node's deepEqual() algorithm](https://github.com/substack/node-deep-equal) with loose comparisons (`==`) on leaf nodes and an optional description of the assertion `msg`. +Assert that `actual` and `expected` do not have the same structure and nested values using [node's deepEqual() algorithm](https://github.com/inspect-js/node-deep-equal) with loose comparisons (`==`) on leaf nodes and an optional description of the assertion `msg`. Aliases: `t.notLooseEqual()`, `t.notLooseEquals()` @@ -557,17 +557,17 @@ test('third', function (t) { MIT [package-url]: https://npmjs.org/package/tape -[npm-version-svg]: https://versionbadg.es/substack/tape.svg -[deps-svg]: https://david-dm.org/substack/tape.svg -[deps-url]: https://david-dm.org/substack/tape -[dev-deps-svg]: https://david-dm.org/substack/tape/dev-status.svg -[dev-deps-url]: https://david-dm.org/substack/tape#info=devDependencies +[npm-version-svg]: https://versionbadg.es/ljharb/tape.svg +[deps-svg]: https://david-dm.org/ljharb/tape.svg +[deps-url]: https://david-dm.org/ljharb/tape +[dev-deps-svg]: https://david-dm.org/ljharb/tape/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/tape#info=devDependencies [npm-badge-png]: https://nodei.co/npm/tape.png?downloads=true&stars=true [license-image]: https://img.shields.io/npm/l/tape.svg [license-url]: LICENSE [downloads-image]: https://img.shields.io/npm/dm/tape.svg [downloads-url]: https://npm-stat.com/charts.html?package=tape -[codecov-image]: https://codecov.io/gh/substack/tape/branch/master/graphs/badge.svg -[codecov-url]: https://app.codecov.io/gh/substack/tape/ -[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/substack/tape -[actions-url]: https://github.com/substack/tape/actions +[codecov-image]: https://codecov.io/gh/ljharb/tape/branch/master/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/tape/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/tape +[actions-url]: https://github.com/ljharb/tape/actions From b035590f782c211e93a6a44ed8d0e9d38636a286 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sat, 17 Sep 2022 21:33:43 -0700 Subject: [PATCH 04/11] [eslint] fix indentation --- .eslintrc | 1 - bin/tape | 62 +- example/array.js | 52 +- example/fail.js | 52 +- example/nested.js | 86 +-- example/nested_fail.js | 86 +-- example/not_enough.js | 52 +- example/stream/object.js | 4 +- example/stream/tap.js | 2 +- example/stream/test/x.js | 4 +- example/stream/test/y.js | 10 +- example/throw_fail.js | 8 +- example/timing.js | 12 +- example/too_many.js | 52 +- example/two.js | 22 +- index.js | 256 +++---- lib/default_stream.js | 62 +- lib/results.js | 360 +++++----- lib/test.js | 924 ++++++++++++------------- test/add-subtest-async.js | 14 +- test/anonymous-fn.js | 62 +- test/anonymous-fn/test-wrapper.js | 14 +- test/array.js | 108 +-- test/bound.js | 12 +- test/browser/asserts.js | 10 +- test/child_ordering.js | 68 +- test/circular-things.js | 68 +- test/comment.js | 318 ++++----- test/common.js | 90 +-- test/create_multiple_streams.js | 50 +- test/deep-equal-failure.js | 348 +++++----- test/deep.js | 20 +- test/default-messages.js | 76 +- test/double_end.js | 96 +-- test/double_end/double.js | 12 +- test/edge-cases.js | 532 +++++++------- test/end-as-callback.js | 106 +-- test/error.js | 62 +- test/exit.js | 444 ++++++------ test/exit/fail.js | 52 +- test/exit/missing_end.js | 6 +- test/exit/ok.js | 54 +- test/exit/second.js | 8 +- test/exit/todo.js | 4 +- test/exit/todo_fail.js | 4 +- test/exit/too_few.js | 52 +- test/exposed-harness.js | 6 +- test/fail.js | 124 ++-- test/has spaces.js | 58 +- test/ignore/fake_node_modules/stub1.js | 4 +- test/ignore/fake_node_modules/stub2.js | 4 +- test/ignore/test.js | 4 +- test/ignore/test/stub1.js | 4 +- test/ignore/test/stub2.js | 4 +- test/ignore/test/sub/sub.stub1.js | 4 +- test/ignore/test/sub/sub.stub2.js | 4 +- test/ignore/test2.js | 4 +- test/ignore_from_gitignore.js | 192 ++--- test/many.js | 8 +- test/match.js | 456 ++++++------ test/max_listeners.js | 2 +- test/max_listeners/source.js | 8 +- test/messages/defaults.js | 26 +- test/nested-async-plan-noend.js | 54 +- test/nested-sync-noplan-noend.js | 66 +- test/nested.js | 132 ++-- test/nested2.js | 24 +- test/no_only.js | 156 ++--- test/no_only/test-a.js | 4 +- test/no_only/test-b.js | 8 +- test/not-deep-equal-failure.js | 348 +++++----- test/not-equal-failure.js | 104 +-- test/numerics.js | 334 ++++----- test/objectMode.js | 106 +-- test/objectModeWithComment.js | 58 +- test/onFailure.js | 16 +- test/onFinish.js | 14 +- test/only-twice.js | 26 +- test/only.js | 78 +-- test/only2.js | 4 +- test/only3.js | 10 +- test/only4.js | 6 +- test/only5.js | 6 +- test/order.js | 16 +- test/plan_optional.js | 12 +- test/require.js | 102 +-- test/require/a.js | 4 +- test/require/b.js | 4 +- test/require/test-a.js | 6 +- test/require/test-b.js | 6 +- test/skip.js | 60 +- test/skip_explanation.js | 128 ++-- test/stackTrace.js | 464 ++++++------- test/subcount.js | 18 +- test/subtest_and_async.js | 32 +- test/subtest_plan.js | 26 +- test/teardown.js | 460 ++++++------ test/throws.js | 400 +++++------ test/timeout.js | 14 +- test/timeoutAfter.js | 52 +- test/todo.js | 60 +- test/todo_explanation.js | 108 +-- test/todo_single.js | 52 +- test/too_many.js | 126 ++-- test/undef.js | 64 +- 105 files changed, 4738 insertions(+), 4739 deletions(-) diff --git a/.eslintrc b/.eslintrc index 97c0a033..674fac4a 100644 --- a/.eslintrc +++ b/.eslintrc @@ -13,7 +13,6 @@ "array-bracket-spacing": "off", "complexity": "off", "func-style": "warn", - "indent": ["error", 4], "max-lines-per-function": "warn", "max-lines": "warn", "max-statements-per-line": [2, { "max": 2 }], diff --git a/bin/tape b/bin/tape index 2783f5da..35839a88 100755 --- a/bin/tape +++ b/bin/tape @@ -5,64 +5,64 @@ var parseOpts = require('minimist'); var opts = parseOpts(process.argv.slice(2), { - alias: { r: 'require', i: 'ignore' }, - string: ['require', 'ignore'], - boolean: ['only'], - default: { r: [], i: null, only: null } + alias: { r: 'require', i: 'ignore' }, + string: ['require', 'ignore'], + boolean: ['only'], + default: { r: [], i: null, only: null } }); if (typeof opts.only === 'boolean') { - process.env.NODE_TAPE_NO_ONLY_TEST = !opts.only; + process.env.NODE_TAPE_NO_ONLY_TEST = !opts.only; } var cwd = process.cwd(); if (typeof opts.require === 'string') { - opts.require = [opts.require]; + opts.require = [opts.require]; } var resolveModule; opts.require.forEach(function (module) { - if (module) { - if (!resolveModule) { resolveModule = require('resolve').sync; } - // This check ensures we ignore `-r ""`, trailing `-r`, or other silly things the user might (inadvertently) be doing. - require(resolveModule(module, { basedir: cwd })); - } + if (module) { + if (!resolveModule) { resolveModule = require('resolve').sync; } + // This check ensures we ignore `-r ""`, trailing `-r`, or other silly things the user might (inadvertently) be doing. + require(resolveModule(module, { basedir: cwd })); + } }); var resolvePath = require('path').resolve; var matcher; if (typeof opts.ignore === 'string') { - var readFileSync = require('fs').readFileSync; - try { - var ignoreStr = readFileSync(resolvePath(cwd, opts.ignore || '.gitignore'), 'utf-8'); - } catch (e) { - console.error(e.message); - process.exit(2); - } - var ignore = require('dotignore'); - matcher = ignore.createMatcher(ignoreStr); + var readFileSync = require('fs').readFileSync; + try { + var ignoreStr = readFileSync(resolvePath(cwd, opts.ignore || '.gitignore'), 'utf-8'); + } catch (e) { + console.error(e.message); + process.exit(2); + } + var ignore = require('dotignore'); + matcher = ignore.createMatcher(ignoreStr); } var glob = require('glob'); opts._.reduce(function (result, arg) { - if (glob.hasMagic(arg)) { - // If glob does not match, `files` will be an empty array. Note: `glob.sync` may throw an error and crash the node process. - var files = glob.sync(arg); + if (glob.hasMagic(arg)) { + // If glob does not match, `files` will be an empty array. Note: `glob.sync` may throw an error and crash the node process. + var files = glob.sync(arg); - if (!Array.isArray(files)) { - throw new TypeError('unknown error: glob.sync did not return an array or throw. Please report this.'); - } + if (!Array.isArray(files)) { + throw new TypeError('unknown error: glob.sync did not return an array or throw. Please report this.'); + } - return result.concat(files); - } - return result.concat(arg); + return result.concat(files); + } + return result.concat(arg); }, []).filter(function (file) { - return !matcher || !matcher.shouldIgnore(file); + return !matcher || !matcher.shouldIgnore(file); }).forEach(function (file) { - require(resolvePath(cwd, file)); + require(resolvePath(cwd, file)); }); // vim: ft=javascript diff --git a/example/array.js b/example/array.js index 40be4847..d4340380 100644 --- a/example/array.js +++ b/example/array.js @@ -4,34 +4,34 @@ var falafel = require('falafel'); var test = require('../'); test('array', function (t) { - t.plan(5); + t.plan(5); - var src = '(' + function () { - var xs = [ 1, 2, [ 3, 4 ] ]; - var ys = [ 5, 6 ]; - g([ xs, ys ]); - } + ')()'; + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; - var output = falafel(src, function (node) { - if (node.type === 'ArrayExpression') { - node.update('fn(' + node.source() + ')'); - } - }); + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); - var arrays = [ - [3, 4], - [1, 2, [3, 4]], - [5, 6], - [[ 1, 2, [3, 4]], [5, 6]] - ]; + var arrays = [ + [3, 4], + [1, 2, [3, 4]], + [5, 6], + [[ 1, 2, [3, 4]], [5, 6]] + ]; - Function(['fn', 'g'], output)( - function (xs) { - t.same(arrays.shift(), xs); - return xs; - }, - function (xs) { - t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); - } - ); + Function(['fn', 'g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); + } + ); }); diff --git a/example/fail.js b/example/fail.js index 4373c76b..78dd7bca 100644 --- a/example/fail.js +++ b/example/fail.js @@ -4,34 +4,34 @@ var falafel = require('falafel'); var test = require('../'); test('array', function (t) { - t.plan(5); + t.plan(5); - var src = '(' + function () { - var xs = [ 1, 2, [ 3, 4 ] ]; - var ys = [ 5, 6 ]; - g([ xs, ys ]); - } + ')()'; + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; - var output = falafel(src, function (node) { - if (node.type === 'ArrayExpression') { - node.update('fn(' + node.source() + ')'); - } - }); + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); - var arrays = [ - [ 3, 4 ], - [ 1, 2, [ 3, 4 ] ], - [ 5, 6 ], - [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ] - ]; + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ] + ]; - Function(['fn', 'g'], output)( - function (xs) { - t.same(arrays.shift(), xs); - return xs; - }, - function (xs) { - t.same(xs, [ [ 1, 2, [ 3, 4444 ] ], [ 5, 6 ] ]); - } - ); + Function(['fn', 'g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4444 ] ], [ 5, 6 ] ]); + } + ); }); diff --git a/example/nested.js b/example/nested.js index 299f6bb4..dd9c88b3 100644 --- a/example/nested.js +++ b/example/nested.js @@ -4,50 +4,50 @@ var falafel = require('falafel'); var test = require('../'); test('nested array test', function (t) { - t.plan(5); - - var src = '(' + function () { - var xs = [1, 2, [3, 4]]; - var ys = [5, 6]; - g([ xs, ys ]); - } + ')()'; - - var output = falafel(src, function (node) { - if (node.type === 'ArrayExpression') { - node.update('fn(' + node.source() + ')'); - } - }); - - t.test('inside test', function (q) { - q.plan(2); - q.ok(true, 'inside ok'); - - setTimeout(function () { - q.ok(true, 'inside delayed'); - }, 3000); - }); - - var arrays = [ - [3, 4], - [1, 2, [3, 4]], - [5, 6], - [[ 1, 2, [3, 4]], [5, 6]] - ]; - - Function(['fn', 'g'], output)( - function (xs) { - t.same(arrays.shift(), xs); - return xs; - }, - function (xs) { - t.same(xs, [[1, 2, [3, 4]], [5, 6]]); - } - ); + t.plan(5); + + var src = '(' + function () { + var xs = [1, 2, [3, 4]]; + var ys = [5, 6]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + t.test('inside test', function (q) { + q.plan(2); + q.ok(true, 'inside ok'); + + setTimeout(function () { + q.ok(true, 'inside delayed'); + }, 3000); + }); + + var arrays = [ + [3, 4], + [1, 2, [3, 4]], + [5, 6], + [[ 1, 2, [3, 4]], [5, 6]] + ]; + + Function(['fn', 'g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [[1, 2, [3, 4]], [5, 6]]); + } + ); }); test('another', function (t) { - t.plan(1); - setTimeout(function () { - t.ok(true); - }, 100); + t.plan(1); + setTimeout(function () { + t.ok(true); + }, 100); }); diff --git a/example/nested_fail.js b/example/nested_fail.js index 44ea3fd1..ef0e9fd9 100644 --- a/example/nested_fail.js +++ b/example/nested_fail.js @@ -4,50 +4,50 @@ var falafel = require('falafel'); var test = require('../'); test('nested array test', function (t) { - t.plan(5); - - var src = '(' + function () { - var xs = [ 1, 2, [ 3, 4 ] ]; - var ys = [ 5, 6 ]; - g([ xs, ys ]); - } + ')()'; - - var output = falafel(src, function (node) { - if (node.type === 'ArrayExpression') { - node.update('fn(' + node.source() + ')'); - } - }); - - t.test('inside test', function (q) { - q.plan(2); - q.ok(true); - - setTimeout(function () { - q.equal(3, 4); - }, 3000); - }); - - var arrays = [ - [ 3, 4 ], - [ 1, 2, [ 3, 4 ] ], - [ 5, 6 ], - [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ] - ]; - - Function(['fn', 'g'], output)( - function (xs) { - t.same(arrays.shift(), xs); - return xs; - }, - function (xs) { - t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); - } - ); + t.plan(5); + + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + t.test('inside test', function (q) { + q.plan(2); + q.ok(true); + + setTimeout(function () { + q.equal(3, 4); + }, 3000); + }); + + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ] + ]; + + Function(['fn', 'g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); + } + ); }); test('another', function (t) { - t.plan(1); - setTimeout(function () { - t.ok(true); - }, 100); + t.plan(1); + setTimeout(function () { + t.ok(true); + }, 100); }); diff --git a/example/not_enough.js b/example/not_enough.js index e50ccac3..b4c7965e 100644 --- a/example/not_enough.js +++ b/example/not_enough.js @@ -4,34 +4,34 @@ var falafel = require('falafel'); var test = require('../'); test('array', function (t) { - t.plan(8); + t.plan(8); - var src = '(' + function () { - var xs = [ 1, 2, [ 3, 4 ] ]; - var ys = [ 5, 6 ]; - g([ xs, ys ]); - } + ')()'; + var src = '(' + function () { + var xs = [ 1, 2, [ 3, 4 ] ]; + var ys = [ 5, 6 ]; + g([ xs, ys ]); + } + ')()'; - var output = falafel(src, function (node) { - if (node.type === 'ArrayExpression') { - node.update('fn(' + node.source() + ')'); - } - }); + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); - var arrays = [ - [ 3, 4 ], - [ 1, 2, [ 3, 4 ] ], - [ 5, 6 ], - [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ] - ]; + var arrays = [ + [ 3, 4 ], + [ 1, 2, [ 3, 4 ] ], + [ 5, 6 ], + [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ] + ]; - Function(['fn', 'g'], output)( - function (xs) { - t.same(arrays.shift(), xs); - return xs; - }, - function (xs) { - t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); - } - ); + Function(['fn', 'g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]); + } + ); }); diff --git a/example/stream/object.js b/example/stream/object.js index 39c662ce..ebed86e3 100644 --- a/example/stream/object.js +++ b/example/stream/object.js @@ -4,9 +4,9 @@ var test = require('../../'); var path = require('path'); test.createStream({ objectMode: true }).on('data', function (row) { - console.log(JSON.stringify(row)); + console.log(JSON.stringify(row)); }); process.argv.slice(2).forEach(function (file) { - require(path.resolve(file)); + require(path.resolve(file)); }); diff --git a/example/stream/tap.js b/example/stream/tap.js index 53d7e232..84f1cd8a 100644 --- a/example/stream/tap.js +++ b/example/stream/tap.js @@ -6,5 +6,5 @@ var path = require('path'); test.createStream().pipe(process.stdout); process.argv.slice(2).forEach(function (file) { - require(path.resolve(file)); + require(path.resolve(file)); }); diff --git a/example/stream/test/x.js b/example/stream/test/x.js index 670baa56..40ef5e4d 100644 --- a/example/stream/test/x.js +++ b/example/stream/test/x.js @@ -2,6 +2,6 @@ var test = require('../../../'); test(function (t) { - t.plan(1); - t.equal('beep', 'boop'); + t.plan(1); + t.equal('beep', 'boop'); }); diff --git a/example/stream/test/y.js b/example/stream/test/y.js index 0a0928f2..06194fb0 100644 --- a/example/stream/test/y.js +++ b/example/stream/test/y.js @@ -2,12 +2,12 @@ var test = require('../../../'); test(function (t) { - t.plan(2); - t.equal(1 + 1, 2); - t.ok(true); + t.plan(2); + t.equal(1 + 1, 2); + t.ok(true); }); test('wheee', function (t) { - t.ok(true); - t.end(); + t.ok(true); + t.end(); }); diff --git a/example/throw_fail.js b/example/throw_fail.js index ef82c3ae..eeacc5e4 100644 --- a/example/throw_fail.js +++ b/example/throw_fail.js @@ -3,9 +3,9 @@ var test = require('../'); test('throw', function (t) { - t.plan(2); + t.plan(2); - setTimeout(function () { - throw new Error('doom'); - }, 100); + setTimeout(function () { + throw new Error('doom'); + }, 100); }); diff --git a/example/timing.js b/example/timing.js index 4754776f..6a958d19 100644 --- a/example/timing.js +++ b/example/timing.js @@ -3,12 +3,12 @@ var test = require('../'); test('timing test', function (t) { - t.plan(2); + t.plan(2); - t.equal(typeof Date.now, 'function'); - var start = new Date(); + t.equal(typeof Date.now, 'function'); + var start = new Date(); - setTimeout(function () { - t.equal(new Date() - start, 100); - }, 100); + setTimeout(function () { + t.equal(new Date() - start, 100); + }, 100); }); diff --git a/example/too_many.js b/example/too_many.js index 2ae76502..8f0c5be4 100644 --- a/example/too_many.js +++ b/example/too_many.js @@ -4,34 +4,34 @@ var falafel = require('falafel'); var test = require('../'); test('array', function (t) { - t.plan(3); + t.plan(3); - var src = '(' + function () { - var xs = [1, 2, [3, 4]]; - var ys = [5, 6]; - g([ xs, ys ]); - } + ')()'; + var src = '(' + function () { + var xs = [1, 2, [3, 4]]; + var ys = [5, 6]; + g([ xs, ys ]); + } + ')()'; - var output = falafel(src, function (node) { - if (node.type === 'ArrayExpression') { - node.update('fn(' + node.source() + ')'); - } - }); + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); - var arrays = [ - [3, 4], - [1, 2, [3, 4]], - [5, 6], - [[1, 2, [3, 4]], [5, 6]] - ]; + var arrays = [ + [3, 4], + [1, 2, [3, 4]], + [5, 6], + [[1, 2, [3, 4]], [5, 6]] + ]; - Function(['fn', 'g'], output)( - function (xs) { - t.same(arrays.shift(), xs); - return xs; - }, - function (xs) { - t.same(xs, [[1, 2, [3, 4]], [5, 6]]); - } - ); + Function(['fn', 'g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [[1, 2, [3, 4]], [5, 6]]); + } + ); }); diff --git a/example/two.js b/example/two.js index de5b213a..79424c13 100644 --- a/example/two.js +++ b/example/two.js @@ -3,18 +3,18 @@ var test = require('../'); test('one', function (t) { - t.plan(2); - t.ok(true); - setTimeout(function () { - t.equal(1 + 3, 4); - }, 100); + t.plan(2); + t.ok(true); + setTimeout(function () { + t.equal(1 + 3, 4); + }, 100); }); test('two', function (t) { - t.plan(3); - t.equal(5, 2 + 3); - setTimeout(function () { - t.equal('a'.charCodeAt(0), 97); - t.ok(true); - }, 50); + t.plan(3); + t.equal(5, 2 + 3); + setTimeout(function () { + t.equal('a'.charCodeAt(0), 97); + t.ok(true); + }, 50); }); diff --git a/index.js b/index.js index 6d32e99b..c6dfd197 100644 --- a/index.js +++ b/index.js @@ -12,86 +12,86 @@ var canExit = typeof process !== 'undefined' && process && typeof process.exit === 'function'; module.exports = (function () { - var harness; - var lazyLoad = function () { - // eslint-disable-next-line no-invalid-this - return getHarness().apply(this, arguments); - }; - - lazyLoad.only = function () { - return getHarness().only.apply(this, arguments); - }; - - lazyLoad.createStream = function (opts) { - var options = opts || {}; - if (!harness) { - var output = through(); - getHarness({ stream: output, objectMode: options.objectMode }); - return output; - } - return harness.createStream(options); - }; - - lazyLoad.onFinish = function () { - return getHarness().onFinish.apply(this, arguments); - }; - - lazyLoad.onFailure = function () { - return getHarness().onFailure.apply(this, arguments); - }; - - lazyLoad.getHarness = getHarness; - - return lazyLoad; - - function getHarness(opts) { - if (!opts) { opts = {}; } - opts.autoclose = !canEmitExit; - if (!harness) { harness = createExitHarness(opts); } - return harness; - } + var harness; + var lazyLoad = function () { + // eslint-disable-next-line no-invalid-this + return getHarness().apply(this, arguments); + }; + + lazyLoad.only = function () { + return getHarness().only.apply(this, arguments); + }; + + lazyLoad.createStream = function (opts) { + var options = opts || {}; + if (!harness) { + var output = through(); + getHarness({ stream: output, objectMode: options.objectMode }); + return output; + } + return harness.createStream(options); + }; + + lazyLoad.onFinish = function () { + return getHarness().onFinish.apply(this, arguments); + }; + + lazyLoad.onFailure = function () { + return getHarness().onFailure.apply(this, arguments); + }; + + lazyLoad.getHarness = getHarness; + + return lazyLoad; + + function getHarness(opts) { + if (!opts) { opts = {}; } + opts.autoclose = !canEmitExit; + if (!harness) { harness = createExitHarness(opts); } + return harness; + } }()); function createExitHarness(conf) { - var config = conf || {}; - var harness = createHarness({ - autoclose: defined(config.autoclose, false), - noOnly: defined(conf.noOnly, defined(process.env.NODE_TAPE_NO_ONLY_TEST, false)) - }); - - var stream = harness.createStream({ objectMode: conf.objectMode }); - var es = stream.pipe(conf.stream || createDefaultStream()); - if (canEmitExit) { - // eslint-disable-next-line no-unused-vars - es.on('error', function (err) { harness._exitCode = 1; }); - } - - var ended = false; - stream.on('end', function () { ended = true; }); - - if (config.exit === false) { return harness; } - if (!canEmitExit || !canExit) { return harness; } - - process.on('exit', function (code) { - // let the process exit cleanly. - if (code !== 0) { - return; - } - - if (!ended) { - var only = harness._results._only; - for (var i = 0; i < harness._tests.length; i++) { - var t = harness._tests[i]; - if (!only || t === only) { - t._exit(); - } - } - } - harness.close(); - process.exit(code || harness._exitCode); // eslint-disable-line no-process-exit - }); - - return harness; + var config = conf || {}; + var harness = createHarness({ + autoclose: defined(config.autoclose, false), + noOnly: defined(conf.noOnly, defined(process.env.NODE_TAPE_NO_ONLY_TEST, false)) + }); + + var stream = harness.createStream({ objectMode: conf.objectMode }); + var es = stream.pipe(conf.stream || createDefaultStream()); + if (canEmitExit) { + // eslint-disable-next-line no-unused-vars + es.on('error', function (err) { harness._exitCode = 1; }); + } + + var ended = false; + stream.on('end', function () { ended = true; }); + + if (config.exit === false) { return harness; } + if (!canEmitExit || !canExit) { return harness; } + + process.on('exit', function (code) { + // let the process exit cleanly. + if (code !== 0) { + return; + } + + if (!ended) { + var only = harness._results._only; + for (var i = 0; i < harness._tests.length; i++) { + var t = harness._tests[i]; + if (!only || t === only) { + t._exit(); + } + } + } + harness.close(); + process.exit(code || harness._exitCode); // eslint-disable-line no-process-exit + }); + + return harness; } module.exports.createHarness = createHarness; @@ -100,55 +100,55 @@ module.exports.test = module.exports; // tap compat module.exports.test.skip = Test.skip; function createHarness(conf_) { - var results = createResult(); - if (!conf_ || conf_.autoclose !== false) { - results.once('done', function () { results.close(); }); - } - - var test = function (name, conf, cb) { - var t = new Test(name, conf, cb); - test._tests.push(t); - - (function inspectCode(st) { - st.on('test', function sub(st_) { - inspectCode(st_); - }); - st.on('result', function (r) { - if (!r.todo && !r.ok && typeof r !== 'string') { test._exitCode = 1; } - }); - }(t)); - - results.push(t); - return t; - }; - test._results = results; - - test._tests = []; - - test.createStream = function (opts) { - return results.createStream(opts); - }; - - test.onFinish = function (cb) { - results.on('done', cb); - }; - - test.onFailure = function (cb) { - results.on('fail', cb); - }; - - var only = false; - test.only = function () { - if (only) { throw new Error('there can only be one only test'); } - if (conf_.noOnly) { throw new Error('`only` tests are prohibited'); } - only = true; - var t = test.apply(null, arguments); - results.only(t); - return t; - }; - test._exitCode = 0; - - test.close = function () { results.close(); }; - - return test; + var results = createResult(); + if (!conf_ || conf_.autoclose !== false) { + results.once('done', function () { results.close(); }); + } + + var test = function (name, conf, cb) { + var t = new Test(name, conf, cb); + test._tests.push(t); + + (function inspectCode(st) { + st.on('test', function sub(st_) { + inspectCode(st_); + }); + st.on('result', function (r) { + if (!r.todo && !r.ok && typeof r !== 'string') { test._exitCode = 1; } + }); + }(t)); + + results.push(t); + return t; + }; + test._results = results; + + test._tests = []; + + test.createStream = function (opts) { + return results.createStream(opts); + }; + + test.onFinish = function (cb) { + results.on('done', cb); + }; + + test.onFailure = function (cb) { + results.on('fail', cb); + }; + + var only = false; + test.only = function () { + if (only) { throw new Error('there can only be one only test'); } + if (conf_.noOnly) { throw new Error('`only` tests are prohibited'); } + only = true; + var t = test.apply(null, arguments); + results.only(t); + return t; + }; + test._exitCode = 0; + + test.close = function () { results.close(); }; + + return test; } diff --git a/lib/default_stream.js b/lib/default_stream.js index 9e6372ec..2b355548 100644 --- a/lib/default_stream.js +++ b/lib/default_stream.js @@ -4,37 +4,37 @@ var through = require('through'); var fs = require('fs'); module.exports = function () { - var line = ''; - var stream = through(write, flush); - return stream; + var line = ''; + var stream = through(write, flush); + return stream; - function write(buf) { - for (var i = 0; i < buf.length; i++) { - var c = typeof buf === 'string' - ? buf.charAt(i) - : String.fromCharCode(buf[i]); - if (c === '\n') { - flush(); - } else { - line += c; - } - } - } + function write(buf) { + for (var i = 0; i < buf.length; i++) { + var c = typeof buf === 'string' + ? buf.charAt(i) + : String.fromCharCode(buf[i]); + if (c === '\n') { + flush(); + } else { + line += c; + } + } + } - function flush() { - if (fs.writeSync && (/^win/).test(process.platform)) { - try { - fs.writeSync(1, line + '\n'); - } catch (e) { - stream.emit('error', e); - } - } else { - try { - console.log(line); // eslint-disable-line no-console - } catch (e) { - stream.emit('error', e); - } - } - line = ''; - } + function flush() { + if (fs.writeSync && (/^win/).test(process.platform)) { + try { + fs.writeSync(1, line + '\n'); + } catch (e) { + stream.emit('error', e); + } + } else { + try { + console.log(line); // eslint-disable-line no-console + } catch (e) { + stream.emit('error', e); + } + } + line = ''; + } }; diff --git a/lib/results.js b/lib/results.js index 72de9ba0..7554da62 100644 --- a/lib/results.js +++ b/lib/results.js @@ -15,211 +15,211 @@ module.exports = Results; inherits(Results, EventEmitter); function coalesceWhiteSpaces(str) { - return String(str).replace(/\s+/g, ' '); + return String(str).replace(/\s+/g, ' '); } function Results() { - if (!(this instanceof Results)) { return new Results(); } - this.count = 0; - this.fail = 0; - this.pass = 0; - this.todo = 0; - this._stream = through(); - this.tests = []; - this._only = null; - this._isRunning = false; + if (!(this instanceof Results)) { return new Results(); } + this.count = 0; + this.fail = 0; + this.pass = 0; + this.todo = 0; + this._stream = through(); + this.tests = []; + this._only = null; + this._isRunning = false; } Results.prototype.createStream = function (opts) { - if (!opts) { opts = {}; } - var self = this; - var output; - var testId = 0; - if (opts.objectMode) { - output = through(); - self.on('_push', function ontest(t, extra) { - if (!extra) { extra = {}; } - var id = testId++; - t.once('prerun', function () { - var row = { - type: 'test', - name: t.name, - id: id, - skip: t._skip, - todo: t._todo - }; - if (has(extra, 'parent')) { - row.parent = extra.parent; - } - output.queue(row); - }); - t.on('test', function (st) { - ontest(st, { parent: id }); - }); - t.on('result', function (res) { - if (res && typeof res === 'object') { - res.test = id; - res.type = 'assert'; - } - output.queue(res); - }); - t.on('end', function () { - output.queue({ type: 'end', test: id }); - }); - }); - self.on('done', function () { output.queue(null); }); - } else { - output = resumer(); - output.queue('TAP version 13\n'); - self._stream.pipe(output); - } - - if (!this._isRunning) { - this._isRunning = true; - nextTick(function next() { - var t; - while (t = getNextTest(self)) { - t.run(); - if (!t.ended) { - t.once('end', function () { nextTick(next); }); - return; - } - } - self.emit('done'); - }); - } - - return output; + if (!opts) { opts = {}; } + var self = this; + var output; + var testId = 0; + if (opts.objectMode) { + output = through(); + self.on('_push', function ontest(t, extra) { + if (!extra) { extra = {}; } + var id = testId++; + t.once('prerun', function () { + var row = { + type: 'test', + name: t.name, + id: id, + skip: t._skip, + todo: t._todo + }; + if (has(extra, 'parent')) { + row.parent = extra.parent; + } + output.queue(row); + }); + t.on('test', function (st) { + ontest(st, { parent: id }); + }); + t.on('result', function (res) { + if (res && typeof res === 'object') { + res.test = id; + res.type = 'assert'; + } + output.queue(res); + }); + t.on('end', function () { + output.queue({ type: 'end', test: id }); + }); + }); + self.on('done', function () { output.queue(null); }); + } else { + output = resumer(); + output.queue('TAP version 13\n'); + self._stream.pipe(output); + } + + if (!this._isRunning) { + this._isRunning = true; + nextTick(function next() { + var t; + while (t = getNextTest(self)) { + t.run(); + if (!t.ended) { + t.once('end', function () { nextTick(next); }); + return; + } + } + self.emit('done'); + }); + } + + return output; }; Results.prototype.push = function (t) { - var self = this; - self.tests.push(t); - self._watch(t); - self.emit('_push', t); + var self = this; + self.tests.push(t); + self._watch(t); + self.emit('_push', t); }; Results.prototype.only = function (t) { - this._only = t; + this._only = t; }; Results.prototype._watch = function (t) { - var self = this; - var write = function (s) { self._stream.queue(s); }; - t.once('prerun', function () { - var premsg = ''; - if (t._skip) { - premsg = 'SKIP '; - } else if (t._todo) { - premsg = 'TODO '; - } - write('# ' + premsg + coalesceWhiteSpaces(t.name) + '\n'); - }); - - t.on('result', function (res) { - if (typeof res === 'string') { - write('# ' + res + '\n'); - return; - } - write(encodeResult(res, self.count + 1)); - self.count++; - - if (res.ok || res.todo) { - self.pass++; - } else { - self.fail++; - self.emit('fail'); - } - }); - - t.on('test', function (st) { self._watch(st); }); + var self = this; + var write = function (s) { self._stream.queue(s); }; + t.once('prerun', function () { + var premsg = ''; + if (t._skip) { + premsg = 'SKIP '; + } else if (t._todo) { + premsg = 'TODO '; + } + write('# ' + premsg + coalesceWhiteSpaces(t.name) + '\n'); + }); + + t.on('result', function (res) { + if (typeof res === 'string') { + write('# ' + res + '\n'); + return; + } + write(encodeResult(res, self.count + 1)); + self.count++; + + if (res.ok || res.todo) { + self.pass++; + } else { + self.fail++; + self.emit('fail'); + } + }); + + t.on('test', function (st) { self._watch(st); }); }; Results.prototype.close = function () { - var self = this; - if (self.closed) { self._stream.emit('error', new Error('ALREADY CLOSED')); } - self.closed = true; - var write = function (s) { self._stream.queue(s); }; - - write('\n1..' + self.count + '\n'); - write('# tests ' + self.count + '\n'); - write('# pass ' + (self.pass + self.todo) + '\n'); - if (self.todo) { - write('# todo ' + self.todo + '\n'); - } if (self.fail) { - write('# fail ' + self.fail + '\n'); - } else { - write('\n# ok\n'); - } - - self._stream.queue(null); + var self = this; + if (self.closed) { self._stream.emit('error', new Error('ALREADY CLOSED')); } + self.closed = true; + var write = function (s) { self._stream.queue(s); }; + + write('\n1..' + self.count + '\n'); + write('# tests ' + self.count + '\n'); + write('# pass ' + (self.pass + self.todo) + '\n'); + if (self.todo) { + write('# todo ' + self.todo + '\n'); + } if (self.fail) { + write('# fail ' + self.fail + '\n'); + } else { + write('\n# ok\n'); + } + + self._stream.queue(null); }; function encodeResult(res, count) { - var output = ''; - output += (res.ok ? 'ok ' : 'not ok ') + count; - output += res.name ? ' ' + coalesceWhiteSpaces(res.name) : ''; - - if (res.skip) { - output += ' # SKIP' + (typeof res.skip === 'string' ? ' ' + coalesceWhiteSpaces(res.skip) : ''); - } else if (res.todo) { - output += ' # TODO' + (typeof res.todo === 'string' ? ' ' + coalesceWhiteSpaces(res.todo) : ''); - } - - output += '\n'; - if (res.ok) { return output; } - - var outer = ' '; - var inner = outer + ' '; - output += outer + '---\n'; - output += inner + 'operator: ' + res.operator + '\n'; - - if (has(res, 'expected') || has(res, 'actual')) { - var ex = inspect(res.expected, { depth: res.objectPrintDepth }); - var ac = inspect(res.actual, { depth: res.objectPrintDepth }); - - if (Math.max(ex.length, ac.length) > 65 || invalidYaml(ex) || invalidYaml(ac)) { - output += inner + 'expected: |-\n' + inner + ' ' + ex + '\n'; - output += inner + 'actual: |-\n' + inner + ' ' + ac + '\n'; - } else { - output += inner + 'expected: ' + ex + '\n'; - output += inner + 'actual: ' + ac + '\n'; - } - } - if (res.at) { - output += inner + 'at: ' + res.at + '\n'; - } - - var actualStack = res.actual && (typeof res.actual === 'object' || typeof res.actual === 'function') ? res.actual.stack : undefined; - var errorStack = res.error && res.error.stack; - var stack = defined(actualStack, errorStack); - if (stack) { - var lines = String(stack).split('\n'); - output += inner + 'stack: |-\n'; - for (var i = 0; i < lines.length; i++) { - output += inner + ' ' + lines[i] + '\n'; - } - } - - output += outer + '...\n'; - return output; + var output = ''; + output += (res.ok ? 'ok ' : 'not ok ') + count; + output += res.name ? ' ' + coalesceWhiteSpaces(res.name) : ''; + + if (res.skip) { + output += ' # SKIP' + (typeof res.skip === 'string' ? ' ' + coalesceWhiteSpaces(res.skip) : ''); + } else if (res.todo) { + output += ' # TODO' + (typeof res.todo === 'string' ? ' ' + coalesceWhiteSpaces(res.todo) : ''); + } + + output += '\n'; + if (res.ok) { return output; } + + var outer = ' '; + var inner = outer + ' '; + output += outer + '---\n'; + output += inner + 'operator: ' + res.operator + '\n'; + + if (has(res, 'expected') || has(res, 'actual')) { + var ex = inspect(res.expected, { depth: res.objectPrintDepth }); + var ac = inspect(res.actual, { depth: res.objectPrintDepth }); + + if (Math.max(ex.length, ac.length) > 65 || invalidYaml(ex) || invalidYaml(ac)) { + output += inner + 'expected: |-\n' + inner + ' ' + ex + '\n'; + output += inner + 'actual: |-\n' + inner + ' ' + ac + '\n'; + } else { + output += inner + 'expected: ' + ex + '\n'; + output += inner + 'actual: ' + ac + '\n'; + } + } + if (res.at) { + output += inner + 'at: ' + res.at + '\n'; + } + + var actualStack = res.actual && (typeof res.actual === 'object' || typeof res.actual === 'function') ? res.actual.stack : undefined; + var errorStack = res.error && res.error.stack; + var stack = defined(actualStack, errorStack); + if (stack) { + var lines = String(stack).split('\n'); + output += inner + 'stack: |-\n'; + for (var i = 0; i < lines.length; i++) { + output += inner + ' ' + lines[i] + '\n'; + } + } + + output += outer + '...\n'; + return output; } function getNextTest(results) { - if (!results._only) { - return results.tests.shift(); - } - - do { - var t = results.tests.shift(); - if (t && results._only === t) { - return t; - } - } while (results.tests.length !== 0); - - return void undefined; + if (!results._only) { + return results.tests.shift(); + } + + do { + var t = results.tests.shift(); + if (t && results._only === t) { + return t; + } + } while (results.tests.length !== 0); + + return void undefined; } function invalidYaml(str) { - return $exec(yamlIndicators, str) !== null; + return $exec(yamlIndicators, str) !== null; } diff --git a/lib/test.js b/lib/test.js index 2e6c8a0b..9b369492 100644 --- a/lib/test.js +++ b/lib/test.js @@ -19,8 +19,8 @@ var objectToString = callBound('Object.prototype.toString'); module.exports = Test; var nextTick = typeof setImmediate !== 'undefined' - ? setImmediate - : process.nextTick; + ? setImmediate + : process.nextTick; var safeSetTimeout = setTimeout; var safeClearTimeout = clearTimeout; @@ -28,260 +28,260 @@ inherits(Test, EventEmitter); // eslint-disable-next-line no-unused-vars var getTestArgs = function (name_, opts_, cb_) { - var name = '(anonymous)'; - var opts = {}; - var cb; - - for (var i = 0; i < arguments.length; i++) { - var arg = arguments[i]; - var t = typeof arg; - if (t === 'string') { - name = arg; - } else if (t === 'object') { - opts = arg || opts; - } else if (t === 'function') { - cb = arg; - } - } - return { - name: name, - opts: opts, - cb: cb - }; + var name = '(anonymous)'; + var opts = {}; + var cb; + + for (var i = 0; i < arguments.length; i++) { + var arg = arguments[i]; + var t = typeof arg; + if (t === 'string') { + name = arg; + } else if (t === 'object') { + opts = arg || opts; + } else if (t === 'function') { + cb = arg; + } + } + return { + name: name, + opts: opts, + cb: cb + }; }; function Test(name_, opts_, cb_) { - if (!(this instanceof Test)) { - return new Test(name_, opts_, cb_); - } - - var args = getTestArgs(name_, opts_, cb_); - - this.readable = true; - this.name = args.name || '(anonymous)'; - this.assertCount = 0; - this.pendingCount = 0; - this._skip = args.opts.skip || false; - this._todo = args.opts.todo || false; - this._timeout = args.opts.timeout; - this._plan = undefined; - this._cb = args.cb; - this._progeny = []; - this._teardown = []; - this._ok = true; - var depthEnvVar = process.env.NODE_TAPE_OBJECT_PRINT_DEPTH; - if (args.opts.objectPrintDepth) { - this._objectPrintDepth = args.opts.objectPrintDepth; - } else if (depthEnvVar) { - if (toLowerCase(depthEnvVar) === 'infinity') { - this._objectPrintDepth = Infinity; - } else { - this._objectPrintDepth = depthEnvVar; - } - } else { - this._objectPrintDepth = 5; - } - - for (var prop in this) { - this[prop] = (function bind(self, val) { - if (typeof val === 'function') { - return function bound() { - return val.apply(self, arguments); - }; - } - return val; - }(this, this[prop])); - } + if (!(this instanceof Test)) { + return new Test(name_, opts_, cb_); + } + + var args = getTestArgs(name_, opts_, cb_); + + this.readable = true; + this.name = args.name || '(anonymous)'; + this.assertCount = 0; + this.pendingCount = 0; + this._skip = args.opts.skip || false; + this._todo = args.opts.todo || false; + this._timeout = args.opts.timeout; + this._plan = undefined; + this._cb = args.cb; + this._progeny = []; + this._teardown = []; + this._ok = true; + var depthEnvVar = process.env.NODE_TAPE_OBJECT_PRINT_DEPTH; + if (args.opts.objectPrintDepth) { + this._objectPrintDepth = args.opts.objectPrintDepth; + } else if (depthEnvVar) { + if (toLowerCase(depthEnvVar) === 'infinity') { + this._objectPrintDepth = Infinity; + } else { + this._objectPrintDepth = depthEnvVar; + } + } else { + this._objectPrintDepth = 5; + } + + for (var prop in this) { + this[prop] = (function bind(self, val) { + if (typeof val === 'function') { + return function bound() { + return val.apply(self, arguments); + }; + } + return val; + }(this, this[prop])); + } } Test.prototype.run = function run() { - this.emit('prerun'); - if (!this._cb || this._skip) { - this._end(); - return; - } - if (this._timeout != null) { - this.timeoutAfter(this._timeout); - } - this._cb(this); - this.emit('run'); + this.emit('prerun'); + if (!this._cb || this._skip) { + this._end(); + return; + } + if (this._timeout != null) { + this.timeoutAfter(this._timeout); + } + this._cb(this); + this.emit('run'); }; Test.prototype.test = function (name, opts, cb) { - var self = this; - var t = new Test(name, opts, cb); - this._progeny.push(t); - this.pendingCount++; - this.emit('test', t); - t.on('prerun', function () { - self.assertCount++; - }); - - if (!self._pendingAsserts()) { - nextTick(function () { - self._end(); - }); - } - - nextTick(function () { - if (!self._plan && self.pendingCount == self._progeny.length) { - self._end(); - } - }); + var self = this; + var t = new Test(name, opts, cb); + this._progeny.push(t); + this.pendingCount++; + this.emit('test', t); + t.on('prerun', function () { + self.assertCount++; + }); + + if (!self._pendingAsserts()) { + nextTick(function () { + self._end(); + }); + } + + nextTick(function () { + if (!self._plan && self.pendingCount == self._progeny.length) { + self._end(); + } + }); }; Test.prototype.comment = function (msg) { - var that = this; - forEach(trim(msg).split('\n'), function (aMsg) { - that.emit('result', trim(aMsg).replace(/^#\s*/, '')); - }); + var that = this; + forEach(trim(msg).split('\n'), function (aMsg) { + that.emit('result', trim(aMsg).replace(/^#\s*/, '')); + }); }; Test.prototype.plan = function (n) { - this._plan = n; - this.emit('plan', n); + this._plan = n; + this.emit('plan', n); }; Test.prototype.timeoutAfter = function (ms) { - if (!ms) { throw new Error('timeoutAfter requires a timespan'); } - var self = this; - var timeout = safeSetTimeout(function () { - self.fail(self.name + ' timed out after ' + ms + 'ms'); - self.end(); - }, ms); - this.once('end', function () { - safeClearTimeout(timeout); - }); + if (!ms) { throw new Error('timeoutAfter requires a timespan'); } + var self = this; + var timeout = safeSetTimeout(function () { + self.fail(self.name + ' timed out after ' + ms + 'ms'); + self.end(); + }, ms); + this.once('end', function () { + safeClearTimeout(timeout); + }); }; Test.prototype.end = function end(err) { - if (arguments.length >= 1 && !!err) { - this.ifError(err); - } - - if (this.calledEnd) { - this.fail('.end() already called'); - } - this.calledEnd = true; - this._end(); + if (arguments.length >= 1 && !!err) { + this.ifError(err); + } + + if (this.calledEnd) { + this.fail('.end() already called'); + } + this.calledEnd = true; + this._end(); }; Test.prototype.teardown = function (fn) { - if (typeof fn !== 'function') { - this.fail('teardown: ' + inspect(fn) + ' is not a function'); - } else { - this._teardown.push(fn); - } + if (typeof fn !== 'function') { + this.fail('teardown: ' + inspect(fn) + ' is not a function'); + } else { + this._teardown.push(fn); + } }; Test.prototype._end = function (err) { - var self = this; - if (this._progeny.length) { - var t = this._progeny.shift(); - t.on('end', function () { self._end(); }); - t.run(); - return; - } - - function next(i) { - if (i === self._teardown.length) { - completeEnd(); - return; - } - var fn = self._teardown[i]; - var res; - try { - res = fn(); - } catch (e) { - self.fail(e); - } - if (res && typeof res.then === 'function') { - res.then(function () { - next(++i); - }, function (_err) { - err = err || _err; - }); - } else { - next(++i); - } - } - - if (this._teardown.length > 0) { - next(0); - } else { - completeEnd(); - } - - function completeEnd() { - if (!self.ended) { self.emit('end'); } - var pendingAsserts = self._pendingAsserts(); - if (!self._planError && self._plan !== undefined && pendingAsserts) { - self._planError = true; - self.fail('plan != count', { - expected: self._plan, - actual: self.assertCount - }); - } - self.ended = true; - } + var self = this; + if (this._progeny.length) { + var t = this._progeny.shift(); + t.on('end', function () { self._end(); }); + t.run(); + return; + } + + function next(i) { + if (i === self._teardown.length) { + completeEnd(); + return; + } + var fn = self._teardown[i]; + var res; + try { + res = fn(); + } catch (e) { + self.fail(e); + } + if (res && typeof res.then === 'function') { + res.then(function () { + next(++i); + }, function (_err) { + err = err || _err; + }); + } else { + next(++i); + } + } + + if (this._teardown.length > 0) { + next(0); + } else { + completeEnd(); + } + + function completeEnd() { + if (!self.ended) { self.emit('end'); } + var pendingAsserts = self._pendingAsserts(); + if (!self._planError && self._plan !== undefined && pendingAsserts) { + self._planError = true; + self.fail('plan != count', { + expected: self._plan, + actual: self.assertCount + }); + } + self.ended = true; + } }; Test.prototype._exit = function () { - if (this._plan !== undefined && !this._planError && this.assertCount !== this._plan) { - this._planError = true; - this.fail('plan != count', { - expected: this._plan, - actual: this.assertCount, - exiting: true - }); - } else if (!this.ended) { - this.fail('test exited without ending: ' + this.name, { - exiting: true - }); - } + if (this._plan !== undefined && !this._planError && this.assertCount !== this._plan) { + this._planError = true; + this.fail('plan != count', { + expected: this._plan, + actual: this.assertCount, + exiting: true + }); + } else if (!this.ended) { + this.fail('test exited without ending: ' + this.name, { + exiting: true + }); + } }; Test.prototype._pendingAsserts = function () { - if (this._plan === undefined) { - return 1; - } - return this._plan - (this._progeny.length + this.assertCount); + if (this._plan === undefined) { + return 1; + } + return this._plan - (this._progeny.length + this.assertCount); }; Test.prototype._assert = function assert(ok, opts) { - var self = this; - var extra = opts.extra || {}; - - ok = !!ok || !!extra.skip; - - var res = { - id: self.assertCount++, - ok: ok, - skip: defined(extra.skip, opts.skip), - todo: defined(extra.todo, opts.todo, self._todo), - name: defined(extra.message, opts.message, '(unnamed assert)'), - operator: defined(extra.operator, opts.operator), - objectPrintDepth: self._objectPrintDepth - }; - if (has(opts, 'actual') || has(extra, 'actual')) { - res.actual = defined(extra.actual, opts.actual); - } - if (has(opts, 'expected') || has(extra, 'expected')) { - res.expected = defined(extra.expected, opts.expected); - } - this._ok = !!(this._ok && ok); - - if (!ok && !res.todo) { - res.error = defined(extra.error, opts.error, new Error(res.name)); - } - - if (!ok) { - var e = new Error('exception'); - var err = (e.stack || '').split('\n'); - var dir = __dirname + path.sep; - - for (var i = 0; i < err.length; i++) { - /* + var self = this; + var extra = opts.extra || {}; + + ok = !!ok || !!extra.skip; + + var res = { + id: self.assertCount++, + ok: ok, + skip: defined(extra.skip, opts.skip), + todo: defined(extra.todo, opts.todo, self._todo), + name: defined(extra.message, opts.message, '(unnamed assert)'), + operator: defined(extra.operator, opts.operator), + objectPrintDepth: self._objectPrintDepth + }; + if (has(opts, 'actual') || has(extra, 'actual')) { + res.actual = defined(extra.actual, opts.actual); + } + if (has(opts, 'expected') || has(extra, 'expected')) { + res.expected = defined(extra.expected, opts.expected); + } + this._ok = !!(this._ok && ok); + + if (!ok && !res.todo) { + res.error = defined(extra.error, opts.error, new Error(res.name)); + } + + if (!ok) { + var e = new Error('exception'); + var err = (e.stack || '').split('\n'); + var dir = __dirname + path.sep; + + for (var i = 0; i < err.length; i++) { + /* Stack trace lines may resemble one of the following. We need to correctly extract a function name (if any) and path / line number for each line. @@ -316,87 +316,87 @@ Test.prototype._assert = function assert(ok, opts) { /((?:\/|[a-zA-Z]:\\)[^:\)]+:(\d+)(?::(\d+))?)\)?/ */ - var re = /^(?:[^\s]*\s*\bat\s+)(?:(.*)\s+\()?((?:\/|[a-zA-Z]:\\)[^:)]+:(\d+)(?::(\d+))?)\)?$/; - var lineWithTokens = err[i].replace(process.cwd(), '/$CWD').replace(__dirname, '/$TEST'); - var m = re.exec(lineWithTokens); - - if (!m) { - continue; - } - - var callDescription = m[1] || ''; - var filePath = m[2].replace('/$CWD', process.cwd()).replace('/$TEST', __dirname); - - if (filePath.slice(0, dir.length) === dir) { - continue; - } - - // Function call description may not (just) be a function name. Try to extract function name by looking at first "word" only. - res.functionName = callDescription.split(/\s+/)[0]; - res.file = filePath; - res.line = Number(m[3]); - if (m[4]) { res.column = Number(m[4]); } - - res.at = callDescription + ' (' + filePath + ')'; - break; - } - } - - self.emit('result', res); - - var pendingAsserts = self._pendingAsserts(); - if (!pendingAsserts) { - if (extra.exiting) { - self._end(); - } else { - nextTick(function () { - self._end(); - }); - } - } - - if (!self._planError && pendingAsserts < 0) { - self._planError = true; - self.fail('plan != count', { - expected: self._plan, - actual: self._plan - pendingAsserts - }); - } + var re = /^(?:[^\s]*\s*\bat\s+)(?:(.*)\s+\()?((?:\/|[a-zA-Z]:\\)[^:)]+:(\d+)(?::(\d+))?)\)?$/; + var lineWithTokens = err[i].replace(process.cwd(), '/$CWD').replace(__dirname, '/$TEST'); + var m = re.exec(lineWithTokens); + + if (!m) { + continue; + } + + var callDescription = m[1] || ''; + var filePath = m[2].replace('/$CWD', process.cwd()).replace('/$TEST', __dirname); + + if (filePath.slice(0, dir.length) === dir) { + continue; + } + + // Function call description may not (just) be a function name. Try to extract function name by looking at first "word" only. + res.functionName = callDescription.split(/\s+/)[0]; + res.file = filePath; + res.line = Number(m[3]); + if (m[4]) { res.column = Number(m[4]); } + + res.at = callDescription + ' (' + filePath + ')'; + break; + } + } + + self.emit('result', res); + + var pendingAsserts = self._pendingAsserts(); + if (!pendingAsserts) { + if (extra.exiting) { + self._end(); + } else { + nextTick(function () { + self._end(); + }); + } + } + + if (!self._planError && pendingAsserts < 0) { + self._planError = true; + self.fail('plan != count', { + expected: self._plan, + actual: self._plan - pendingAsserts + }); + } }; Test.prototype.fail = function (msg, extra) { - this._assert(false, { - message: msg, - operator: 'fail', - extra: extra - }); + this._assert(false, { + message: msg, + operator: 'fail', + extra: extra + }); }; Test.prototype.pass = function (msg, extra) { - this._assert(true, { - message: msg, - operator: 'pass', - extra: extra - }); + this._assert(true, { + message: msg, + operator: 'pass', + extra: extra + }); }; Test.prototype.skip = function (msg, extra) { - this._assert(true, { - message: msg, - operator: 'skip', - skip: true, - extra: extra - }); + this._assert(true, { + message: msg, + operator: 'skip', + skip: true, + extra: extra + }); }; var tapeAssert = function assert(value, msg, extra) { - this._assert(value, { - message: defined(msg, 'should be truthy'), - operator: 'ok', - expected: true, - actual: value, - extra: extra - }); + this._assert(value, { + message: defined(msg, 'should be truthy'), + operator: 'ok', + expected: true, + actual: value, + extra: extra + }); }; Test.prototype.ok = Test.prototype['true'] @@ -404,13 +404,13 @@ Test.prototype.ok = tapeAssert; function notOK(value, msg, extra) { - this._assert(!value, { - message: defined(msg, 'should be falsy'), - operator: 'notOk', - expected: false, - actual: value, - extra: extra - }); + this._assert(!value, { + message: defined(msg, 'should be falsy'), + operator: 'notOk', + expected: false, + actual: value, + extra: extra + }); } Test.prototype.notOk = Test.prototype['false'] @@ -418,12 +418,12 @@ Test.prototype.notOk = notOK; function error(err, msg, extra) { - this._assert(!err, { - message: defined(msg, String(err)), - operator: 'error', - actual: err, - extra: extra - }); + this._assert(!err, { + message: defined(msg, String(err)), + operator: 'error', + actual: err, + extra: extra + }); } Test.prototype.error = Test.prototype.ifError @@ -432,13 +432,13 @@ Test.prototype.error = error; function equal(a, b, msg, extra) { - this._assert(a === b, { - message: defined(msg, 'should be equal'), - operator: 'equal', - actual: a, - expected: b, - extra: extra - }); + this._assert(a === b, { + message: defined(msg, 'should be equal'), + operator: 'equal', + actual: a, + expected: b, + extra: extra + }); } Test.prototype.equal = Test.prototype.equals @@ -449,13 +449,13 @@ Test.prototype.equal = equal; function notEqual(a, b, msg, extra) { - this._assert(a !== b, { - message: defined(msg, 'should not be equal'), - operator: 'notEqual', - actual: a, - expected: b, - extra: extra - }); + this._assert(a !== b, { + message: defined(msg, 'should not be equal'), + operator: 'notEqual', + actual: a, + expected: b, + extra: extra + }); } Test.prototype.notEqual = Test.prototype.notEquals @@ -469,13 +469,13 @@ Test.prototype.notEqual = notEqual; function tapeDeepEqual(a, b, msg, extra) { - this._assert(deepEqual(a, b, { strict: true }), { - message: defined(msg, 'should be equivalent'), - operator: 'deepEqual', - actual: a, - expected: b, - extra: extra - }); + this._assert(deepEqual(a, b, { strict: true }), { + message: defined(msg, 'should be equivalent'), + operator: 'deepEqual', + actual: a, + expected: b, + extra: extra + }); } Test.prototype.deepEqual = Test.prototype.deepEquals @@ -484,13 +484,13 @@ Test.prototype.deepEqual = tapeDeepEqual; function deepLooseEqual(a, b, msg, extra) { - this._assert(deepEqual(a, b), { - message: defined(msg, 'should be equivalent'), - operator: 'deepLooseEqual', - actual: a, - expected: b, - extra: extra - }); + this._assert(deepEqual(a, b), { + message: defined(msg, 'should be equivalent'), + operator: 'deepLooseEqual', + actual: a, + expected: b, + extra: extra + }); } Test.prototype.deepLooseEqual = Test.prototype.looseEqual @@ -498,13 +498,13 @@ Test.prototype.deepLooseEqual = deepLooseEqual; function notDeepEqual(a, b, msg, extra) { - this._assert(!deepEqual(a, b, { strict: true }), { - message: defined(msg, 'should not be equivalent'), - operator: 'notDeepEqual', - actual: a, - expected: b, - extra: extra - }); + this._assert(!deepEqual(a, b, { strict: true }), { + message: defined(msg, 'should not be equivalent'), + operator: 'notDeepEqual', + actual: a, + expected: b, + extra: extra + }); } Test.prototype.notDeepEqual = Test.prototype.notDeepEquals @@ -518,13 +518,13 @@ Test.prototype.notDeepEqual = notDeepEqual; function notDeepLooseEqual(a, b, msg, extra) { - this._assert(!deepEqual(a, b), { - message: defined(msg, 'should be equivalent'), - operator: 'notDeepLooseEqual', - actual: a, - expected: b, - extra: extra - }); + this._assert(!deepEqual(a, b), { + message: defined(msg, 'should be equivalent'), + operator: 'notDeepLooseEqual', + actual: a, + expected: b, + extra: extra + }); } Test.prototype.notDeepLooseEqual = Test.prototype.notLooseEqual @@ -532,137 +532,137 @@ Test.prototype.notDeepLooseEqual = notDeepLooseEqual; Test.prototype['throws'] = function (fn, expected, msg, extra) { - if (typeof expected === 'string') { - msg = expected; - expected = undefined; - } - - var caught; - - try { - fn(); - } catch (err) { - caught = { error: err }; - if (Object(err) === err && (!isEnumerable(err, 'message') || !has(err, 'message'))) { - var message = err.message; - delete err.message; - err.message = message; - } - } - - var passed = caught; - - if (isRegExp(expected)) { - passed = $exec(expected, caught && caught.error) !== null; - expected = String(expected); - } - - if (typeof expected === 'function' && caught) { - passed = caught.error instanceof expected; - } - - this._assert(typeof fn === 'function' && passed, { - message: defined(msg, 'should throw'), - operator: 'throws', - actual: caught && caught.error, - expected: expected, - error: !passed && caught && caught.error, - extra: extra - }); + if (typeof expected === 'string') { + msg = expected; + expected = undefined; + } + + var caught; + + try { + fn(); + } catch (err) { + caught = { error: err }; + if (Object(err) === err && (!isEnumerable(err, 'message') || !has(err, 'message'))) { + var message = err.message; + delete err.message; + err.message = message; + } + } + + var passed = caught; + + if (isRegExp(expected)) { + passed = $exec(expected, caught && caught.error) !== null; + expected = String(expected); + } + + if (typeof expected === 'function' && caught) { + passed = caught.error instanceof expected; + } + + this._assert(typeof fn === 'function' && passed, { + message: defined(msg, 'should throw'), + operator: 'throws', + actual: caught && caught.error, + expected: expected, + error: !passed && caught && caught.error, + extra: extra + }); }; Test.prototype.doesNotThrow = function (fn, expected, msg, extra) { - if (typeof expected === 'string') { - msg = expected; - expected = undefined; - } - var caught; - try { - fn(); - } catch (err) { - caught = { error: err }; - } - this._assert(!caught, { - message: defined(msg, 'should not throw'), - operator: 'throws', - actual: caught && caught.error, - expected: expected, - error: caught && caught.error, - extra: extra - }); + if (typeof expected === 'string') { + msg = expected; + expected = undefined; + } + var caught; + try { + fn(); + } catch (err) { + caught = { error: err }; + } + this._assert(!caught, { + message: defined(msg, 'should not throw'), + operator: 'throws', + actual: caught && caught.error, + expected: expected, + error: caught && caught.error, + extra: extra + }); }; Test.prototype.match = function match(string, regexp, msg, extra) { - if (!isRegExp(regexp)) { - this._assert(false, { - message: defined(msg, 'The "regexp" argument must be an instance of RegExp. Received type ' + typeof regexp + ' (' + inspect(regexp) + ')'), - operator: 'match', - actual: objectToString(regexp), - expected: '[object RegExp]', - extra: extra - }); - } else if (typeof string !== 'string') { - this._assert(false, { - message: defined(msg, 'The "string" argument must be of type string. Received type ' + typeof string + ' (' + inspect(string) + ')'), - operator: 'match', - actual: string === null ? null : typeof string, - expected: 'string', - extra: extra - }); - } else { - var matches = $exec(regexp, string) !== null; - var message = defined( - msg, - 'The input ' + (matches ? 'matched' : 'did not match') + ' the regular expression ' + inspect(regexp) + '. Input: ' + inspect(string) - ); - this._assert(matches, { - message: message, - operator: 'match', - actual: string, - expected: regexp, - extra: extra - }); - } + if (!isRegExp(regexp)) { + this._assert(false, { + message: defined(msg, 'The "regexp" argument must be an instance of RegExp. Received type ' + typeof regexp + ' (' + inspect(regexp) + ')'), + operator: 'match', + actual: objectToString(regexp), + expected: '[object RegExp]', + extra: extra + }); + } else if (typeof string !== 'string') { + this._assert(false, { + message: defined(msg, 'The "string" argument must be of type string. Received type ' + typeof string + ' (' + inspect(string) + ')'), + operator: 'match', + actual: string === null ? null : typeof string, + expected: 'string', + extra: extra + }); + } else { + var matches = $exec(regexp, string) !== null; + var message = defined( + msg, + 'The input ' + (matches ? 'matched' : 'did not match') + ' the regular expression ' + inspect(regexp) + '. Input: ' + inspect(string) + ); + this._assert(matches, { + message: message, + operator: 'match', + actual: string, + expected: regexp, + extra: extra + }); + } }; Test.prototype.doesNotMatch = function doesNotMatch(string, regexp, msg, extra) { - if (!isRegExp(regexp)) { - this._assert(false, { - message: defined(msg, 'The "regexp" argument must be an instance of RegExp. Received type ' + typeof regexp + ' (' + inspect(regexp) + ')'), - operator: 'doesNotMatch', - actual: objectToString(regexp), - expected: '[object RegExp]', - extra: extra - }); - } else if (typeof string !== 'string') { - this._assert(false, { - message: defined(msg, 'The "string" argument must be of type string. Received type ' + typeof string + ' (' + inspect(string) + ')'), - operator: 'doesNotMatch', - actual: string === null ? null : typeof string, - expected: 'string', - extra: extra - }); - } else { - var matches = $exec(regexp, string) !== null; - var message = defined( - msg, - 'The input ' + (matches ? 'was expected to not match' : 'did not match') + ' the regular expression ' + inspect(regexp) + '. Input: ' + inspect(string) - ); - this._assert(!matches, { - message: message, - operator: 'doesNotMatch', - actual: string, - expected: regexp, - extra: extra - }); - } + if (!isRegExp(regexp)) { + this._assert(false, { + message: defined(msg, 'The "regexp" argument must be an instance of RegExp. Received type ' + typeof regexp + ' (' + inspect(regexp) + ')'), + operator: 'doesNotMatch', + actual: objectToString(regexp), + expected: '[object RegExp]', + extra: extra + }); + } else if (typeof string !== 'string') { + this._assert(false, { + message: defined(msg, 'The "string" argument must be of type string. Received type ' + typeof string + ' (' + inspect(string) + ')'), + operator: 'doesNotMatch', + actual: string === null ? null : typeof string, + expected: 'string', + extra: extra + }); + } else { + var matches = $exec(regexp, string) !== null; + var message = defined( + msg, + 'The input ' + (matches ? 'was expected to not match' : 'did not match') + ' the regular expression ' + inspect(regexp) + '. Input: ' + inspect(string) + ); + this._assert(!matches, { + message: message, + operator: 'doesNotMatch', + actual: string, + expected: regexp, + extra: extra + }); + } }; // eslint-disable-next-line no-unused-vars Test.skip = function (name_, _opts, _cb) { - var args = getTestArgs.apply(null, arguments); - args.opts.skip = true; - return new Test(args.name, args.opts, args.cb); + var args = getTestArgs.apply(null, arguments); + args.opts.skip = true; + return new Test(args.name, args.opts, args.cb); }; // vim: set softtabstop=4 shiftwidth=4: diff --git a/test/add-subtest-async.js b/test/add-subtest-async.js index 9d13d44e..dc16e7a5 100644 --- a/test/add-subtest-async.js +++ b/test/add-subtest-async.js @@ -3,11 +3,11 @@ var test = require('../'); test('parent', function (t) { - t.pass('parent'); - setTimeout(function () { - t.test('child', function (st) { - st.pass('child'); - st.end(); - }); - }, 100); + t.pass('parent'); + setTimeout(function () { + t.test('child', function (st) { + st.pass('child'); + st.end(); + }); + }, 100); }); diff --git a/test/anonymous-fn.js b/test/anonymous-fn.js index 9a73ed8a..87c54bcd 100644 --- a/test/anonymous-fn.js +++ b/test/anonymous-fn.js @@ -8,39 +8,39 @@ var stripFullStack = require('./common').stripFullStack; var testWrapper = require('./anonymous-fn/test-wrapper'); tap.test('inside anonymous functions', function (tt) { - tt.plan(1); + tt.plan(1); - var test = tape.createHarness(); - var tc = function (rows) { - var body = stripFullStack(rows.toString('utf8')); + var test = tape.createHarness(); + var tc = function (rows) { + var body = stripFullStack(rows.toString('utf8')); - tt.same(body, [ - 'TAP version 13', - '# wrapped test failure', - 'not ok 1 fail', - ' ---', - ' operator: fail', - ' at: ($TEST/anonymous-fn.js:$LINE:$COL)', - ' stack: |-', - ' Error: fail', - ' [... stack stripped ...]', - ' at $TEST/anonymous-fn.js:$LINE:$COL', - ' at Test. ($TEST/anonymous-fn/test-wrapper.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - '', - '1..1', - '# tests 1', - '# pass 0', - '# fail 1', - '' - ]); - }; + tt.same(body, [ + 'TAP version 13', + '# wrapped test failure', + 'not ok 1 fail', + ' ---', + ' operator: fail', + ' at: ($TEST/anonymous-fn.js:$LINE:$COL)', + ' stack: |-', + ' Error: fail', + ' [... stack stripped ...]', + ' at $TEST/anonymous-fn.js:$LINE:$COL', + ' at Test. ($TEST/anonymous-fn/test-wrapper.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + '', + '1..1', + '# tests 1', + '# pass 0', + '# fail 1', + '' + ]); + }; - test.createStream().pipe(concat(tc)); + test.createStream().pipe(concat(tc)); - test('wrapped test failure', testWrapper(function (t) { - t.fail('fail'); - t.end(); - })); + test('wrapped test failure', testWrapper(function (t) { + t.fail('fail'); + t.end(); + })); }); diff --git a/test/anonymous-fn/test-wrapper.js b/test/anonymous-fn/test-wrapper.js index f79ef485..0c42f00e 100644 --- a/test/anonymous-fn/test-wrapper.js +++ b/test/anonymous-fn/test-wrapper.js @@ -2,17 +2,17 @@ // Example of wrapper function that would invoke tape module.exports = function (testCase) { - return function (t) { - setUp(); - testCase(t); - tearDown(); - }; + return function (t) { + setUp(); + testCase(t); + tearDown(); + }; }; function setUp() { - // ... example ... + // ... example ... } function tearDown() { - // ... example ... + // ... example ... } diff --git a/test/array.js b/test/array.js index 982ddd87..125f438f 100644 --- a/test/array.js +++ b/test/array.js @@ -6,58 +6,58 @@ var tap = require('tap'); var concat = require('concat-stream'); tap.test('array test', function (tt) { - tt.plan(1); - - var test = tape.createHarness(); - - test.createStream().pipe(concat(function (rows) { - tt.same(rows.toString('utf8'), [ - 'TAP version 13', - '# array', - 'ok 1 should be equivalent', - 'ok 2 should be equivalent', - 'ok 3 should be equivalent', - 'ok 4 should be equivalent', - 'ok 5 should be equivalent', - '', - '1..5', - '# tests 5', - '# pass 5', - '', - '# ok' - ].join('\n') + '\n'); - })); - - test('array', function (t) { - t.plan(5); - - var src = '(' + function () { - var xs = [1, 2, [3, 4]]; - var ys = [5, 6]; - g([xs, ys]); - } + ')()'; - - var output = falafel(src, function (node) { - if (node.type === 'ArrayExpression') { - node.update('fn(' + node.source() + ')'); - } - }); - - var arrays = [ - [3, 4], - [1, 2, [3, 4]], - [5, 6], - [[1, 2, [3, 4]], [5, 6]] - ]; - - Function(['fn', 'g'], output)( - function (xs) { - t.same(arrays.shift(), xs); - return xs; - }, - function (xs) { - t.same(xs, [[1, 2, [3, 4]], [5, 6]]); - } - ); - }); + tt.plan(1); + + var test = tape.createHarness(); + + test.createStream().pipe(concat(function (rows) { + tt.same(rows.toString('utf8'), [ + 'TAP version 13', + '# array', + 'ok 1 should be equivalent', + 'ok 2 should be equivalent', + 'ok 3 should be equivalent', + 'ok 4 should be equivalent', + 'ok 5 should be equivalent', + '', + '1..5', + '# tests 5', + '# pass 5', + '', + '# ok' + ].join('\n') + '\n'); + })); + + test('array', function (t) { + t.plan(5); + + var src = '(' + function () { + var xs = [1, 2, [3, 4]]; + var ys = [5, 6]; + g([xs, ys]); + } + ')()'; + + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); + + var arrays = [ + [3, 4], + [1, 2, [3, 4]], + [5, 6], + [[1, 2, [3, 4]], [5, 6]] + ]; + + Function(['fn', 'g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [[1, 2, [3, 4]], [5, 6]]); + } + ); + }); }); diff --git a/test/bound.js b/test/bound.js index cff296b3..e233a5c9 100644 --- a/test/bound.js +++ b/test/bound.js @@ -3,10 +3,10 @@ var test = require('../'); test('bind works', function (t) { - t.plan(2); - var equal = t.equal; - var deepEqual = t.deepEqual; - equal(3, 3); - deepEqual([4], [4]); - t.end(); + t.plan(2); + var equal = t.equal; + var deepEqual = t.deepEqual; + equal(3, 3); + deepEqual([4], [4]); + t.end(); }); diff --git a/test/browser/asserts.js b/test/browser/asserts.js index fb981b7c..0e59e8a0 100644 --- a/test/browser/asserts.js +++ b/test/browser/asserts.js @@ -3,9 +3,9 @@ var test = require('../../'); test(function (t) { - t.plan(4); - t.ok(true); - t.equal(3, 1 + 2); - t.deepEqual([1, 2, [3, 4]], [1, 2, [3, 4]]); - t.notDeepEqual([1, 2, [3, 4, 5]], [1, 2, [3, 4]]); + t.plan(4); + t.ok(true); + t.equal(3, 1 + 2); + t.deepEqual([1, 2, [3, 4]], [1, 2, [3, 4]]); + t.notDeepEqual([1, 2, [3, 4, 5]], [1, 2, [3, 4]]); }); diff --git a/test/child_ordering.js b/test/child_ordering.js index 6c75f587..01263048 100644 --- a/test/child_ordering.js +++ b/test/child_ordering.js @@ -5,52 +5,52 @@ var test = require('../'); var childRan = false; test('parent', function (t) { - t.test('child', function (st) { - childRan = true; - st.pass('child ran'); - st.end(); - }); - t.end(); + t.test('child', function (st) { + childRan = true; + st.pass('child ran'); + st.end(); + }); + t.end(); }); test('uncle', function (t) { - t.ok(childRan, 'Child should run before next top-level test'); - t.end(); + t.ok(childRan, 'Child should run before next top-level test'); + t.end(); }); var grandParentRan = false; var parentRan = false; var grandChildRan = false; test('grandparent', function (t) { - t.ok(!grandParentRan, 'grand parent ran twice'); - grandParentRan = true; - t.test('parent', function (st) { - st.ok(!parentRan, 'parent ran twice'); - parentRan = true; - st.test('grandchild', function (s2t) { - s2t.ok(!grandChildRan, 'grand child ran twice'); - grandChildRan = true; - s2t.pass('grand child ran'); - s2t.end(); - }); - st.pass('parent ran'); - st.end(); - }); - t.test('other parent', function (st) { - st.ok(parentRan, 'first parent runs before second parent'); - st.ok(grandChildRan, 'grandchild runs before second parent'); - st.end(); - }); - t.pass('grandparent ran'); - t.end(); + t.ok(!grandParentRan, 'grand parent ran twice'); + grandParentRan = true; + t.test('parent', function (st) { + st.ok(!parentRan, 'parent ran twice'); + parentRan = true; + st.test('grandchild', function (s2t) { + s2t.ok(!grandChildRan, 'grand child ran twice'); + grandChildRan = true; + s2t.pass('grand child ran'); + s2t.end(); + }); + st.pass('parent ran'); + st.end(); + }); + t.test('other parent', function (st) { + st.ok(parentRan, 'first parent runs before second parent'); + st.ok(grandChildRan, 'grandchild runs before second parent'); + st.end(); + }); + t.pass('grandparent ran'); + t.end(); }); test('second grandparent', function (t) { - t.ok(grandParentRan, 'grandparent ran'); - t.ok(parentRan, 'parent ran'); - t.ok(grandChildRan, 'grandchild ran'); - t.pass('other grandparent ran'); - t.end(); + t.ok(grandParentRan, 'grandparent ran'); + t.ok(parentRan, 'parent ran'); + t.ok(grandChildRan, 'grandchild ran'); + t.pass('other grandparent ran'); + t.end(); }); // vim: set softtabstop=4 shiftwidth=4: diff --git a/test/circular-things.js b/test/circular-things.js index 140727ea..7e4c2fc9 100644 --- a/test/circular-things.js +++ b/test/circular-things.js @@ -7,40 +7,40 @@ var concat = require('concat-stream'); var stripFullStack = require('./common').stripFullStack; tap.test('circular test', function (assert) { - var test = tape.createHarness({ exit: false }); - assert.plan(1); + var test = tape.createHarness({ exit: false }); + assert.plan(1); - test.createStream().pipe(concat(function (body) { - assert.same(stripFullStack(body.toString('utf8')), [ - 'TAP version 13', - '# circular', - 'not ok 1 should be equal', - ' ---', - ' operator: equal', - ' expected: |-', - ' {}', - ' actual: |-', - ' { circular: [Circular] }', - ' at: Test. ($TEST/circular-things.js:$LINE:$COL)', - ' stack: |-', - ' Error: should be equal', - ' [... stack stripped ...]', - ' at Test. ($TEST/circular-things.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - '', - '1..1', - '# tests 1', - '# pass 0', - '# fail 1', - '' - ]); - })); + test.createStream().pipe(concat(function (body) { + assert.same(stripFullStack(body.toString('utf8')), [ + 'TAP version 13', + '# circular', + 'not ok 1 should be equal', + ' ---', + ' operator: equal', + ' expected: |-', + ' {}', + ' actual: |-', + ' { circular: [Circular] }', + ' at: Test. ($TEST/circular-things.js:$LINE:$COL)', + ' stack: |-', + ' Error: should be equal', + ' [... stack stripped ...]', + ' at Test. ($TEST/circular-things.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + '', + '1..1', + '# tests 1', + '# pass 0', + '# fail 1', + '' + ]); + })); - test('circular', function (t) { - t.plan(1); - var circular = {}; - circular.circular = circular; - t.equal(circular, {}); - }); + test('circular', function (t) { + t.plan(1); + var circular = {}; + circular.circular = circular; + t.equal(circular, {}); + }); }); diff --git a/test/comment.js b/test/comment.js index b9933b53..02419028 100644 --- a/test/comment.js +++ b/test/comment.js @@ -7,185 +7,185 @@ var tape = require('../'); // Exploratory test to ascertain proper output when no t.comment() call // is made. tap.test('no comment', function (assert) { - assert.plan(1); - - var verify = function (output) { - assert.equal(output.toString('utf8'), [ - 'TAP version 13', - '# no comment', - '', - '1..0', - '# tests 0', - '# pass 0', - '', - '# ok', - '' - ].join('\n')); - }; - - var test = tape.createHarness(); - test.createStream().pipe(concat(verify)); - test('no comment', function (t) { - t.end(); - }); + assert.plan(1); + + var verify = function (output) { + assert.equal(output.toString('utf8'), [ + 'TAP version 13', + '# no comment', + '', + '1..0', + '# tests 0', + '# pass 0', + '', + '# ok', + '' + ].join('\n')); + }; + + var test = tape.createHarness(); + test.createStream().pipe(concat(verify)); + test('no comment', function (t) { + t.end(); + }); }); // Exploratory test, can we call t.comment() passing nothing? tap.test('missing argument', function (assert) { - assert.plan(1); - var test = tape.createHarness(); - test.createStream(); - test('missing argument', function (t) { - try { - t.comment(); - t.end(); - } catch (err) { - assert.equal(err.constructor, TypeError); - } finally { - assert.end(); - } - }); + assert.plan(1); + var test = tape.createHarness(); + test.createStream(); + test('missing argument', function (t) { + try { + t.comment(); + t.end(); + } catch (err) { + assert.equal(err.constructor, TypeError); + } finally { + assert.end(); + } + }); }); // Exploratory test, can we call t.comment() passing nothing? tap.test('null argument', function (assert) { - assert.plan(1); - var test = tape.createHarness(); - test.createStream(); - test('null argument', function (t) { - try { - t.comment(null); - t.end(); - } catch (err) { - assert.equal(err.constructor, TypeError); - } finally { - assert.end(); - } - }); + assert.plan(1); + var test = tape.createHarness(); + test.createStream(); + test('null argument', function (t) { + try { + t.comment(null); + t.end(); + } catch (err) { + assert.equal(err.constructor, TypeError); + } finally { + assert.end(); + } + }); }); // Exploratory test, how is whitespace treated? tap.test('whitespace', function (assert) { - assert.plan(1); - - var verify = function (output) { - assert.equal(output.toString('utf8'), [ - 'TAP version 13', - '# whitespace', - '# ', - '# a', - '# a', - '# a', - '', - '1..0', - '# tests 0', - '# pass 0', - '', - '# ok', - '' - ].join('\n')); - }; - - var test = tape.createHarness(); - test.createStream().pipe(concat(verify)); - test('whitespace', function (t) { - t.comment(' '); - t.comment(' a'); - t.comment('a '); - t.comment(' a '); - t.end(); - }); + assert.plan(1); + + var verify = function (output) { + assert.equal(output.toString('utf8'), [ + 'TAP version 13', + '# whitespace', + '# ', + '# a', + '# a', + '# a', + '', + '1..0', + '# tests 0', + '# pass 0', + '', + '# ok', + '' + ].join('\n')); + }; + + var test = tape.createHarness(); + test.createStream().pipe(concat(verify)); + test('whitespace', function (t) { + t.comment(' '); + t.comment(' a'); + t.comment('a '); + t.comment(' a '); + t.end(); + }); }); // Exploratory test, how about passing types other than strings? tap.test('non-string types', function (assert) { - assert.plan(1); - - var verify = function (output) { - assert.equal(output.toString('utf8'), [ - 'TAP version 13', - '# non-string types', - '# true', - '# false', - '# 42', - '# 6.66', - '# [object Object]', - '# [object Object]', - '# [object Object]', - '# function ConstructorFunction() {}', - '', - '1..0', - '# tests 0', - '# pass 0', - '', - '# ok', - '' - ].join('\n')); - }; - - var test = tape.createHarness(); - test.createStream().pipe(concat(verify)); - test('non-string types', function (t) { - t.comment(true); - t.comment(false); - t.comment(42); - t.comment(6.66); - t.comment({}); - t.comment({ answer: 42 }); - function ConstructorFunction() {} - t.comment(new ConstructorFunction()); - t.comment(ConstructorFunction); - t.end(); - }); + assert.plan(1); + + var verify = function (output) { + assert.equal(output.toString('utf8'), [ + 'TAP version 13', + '# non-string types', + '# true', + '# false', + '# 42', + '# 6.66', + '# [object Object]', + '# [object Object]', + '# [object Object]', + '# function ConstructorFunction() {}', + '', + '1..0', + '# tests 0', + '# pass 0', + '', + '# ok', + '' + ].join('\n')); + }; + + var test = tape.createHarness(); + test.createStream().pipe(concat(verify)); + test('non-string types', function (t) { + t.comment(true); + t.comment(false); + t.comment(42); + t.comment(6.66); + t.comment({}); + t.comment({ answer: 42 }); + function ConstructorFunction() {} + t.comment(new ConstructorFunction()); + t.comment(ConstructorFunction); + t.end(); + }); }); tap.test('multiline string', function (assert) { - assert.plan(1); - - var verify = function (output) { - assert.equal(output.toString('utf8'), [ - 'TAP version 13', - '# multiline strings', - '# a', - '# b', - '# c', - '# d', - '', - '1..0', - '# tests 0', - '# pass 0', - '', - '# ok', - '' - ].join('\n')); - }; - - var test = tape.createHarness(); - test.createStream().pipe(concat(verify)); - test('multiline strings', function (t) { - t.comment([ - 'a', - 'b' - ].join('\n')); - t.comment([ - 'c', - 'd' - ].join('\r\n')); - t.end(); - }); + assert.plan(1); + + var verify = function (output) { + assert.equal(output.toString('utf8'), [ + 'TAP version 13', + '# multiline strings', + '# a', + '# b', + '# c', + '# d', + '', + '1..0', + '# tests 0', + '# pass 0', + '', + '# ok', + '' + ].join('\n')); + }; + + var test = tape.createHarness(); + test.createStream().pipe(concat(verify)); + test('multiline strings', function (t) { + t.comment([ + 'a', + 'b' + ].join('\n')); + t.comment([ + 'c', + 'd' + ].join('\r\n')); + t.end(); + }); }); tap.test('comment with createStream/objectMode', function (assert) { - assert.plan(1); - - var test = tape.createHarness(); - test.createStream({ objectMode: true }).on('data', function (row) { - if (typeof row === 'string') { - assert.equal(row, 'comment message'); - } - }); - test('t.comment', function (t) { - t.comment('comment message'); - t.end(); - }); + assert.plan(1); + + var test = tape.createHarness(); + test.createStream({ objectMode: true }).on('data', function (row) { + if (typeof row === 'string') { + assert.equal(row, 'comment message'); + } + }); + test('t.comment', function (t) { + t.comment('comment message'); + t.end(); + }); }); diff --git a/test/common.js b/test/common.js index 53ab4f83..c5b9241b 100644 --- a/test/common.js +++ b/test/common.js @@ -4,18 +4,18 @@ var path = require('path'); var yaml = require('js-yaml'); module.exports.getDiag = function (body) { - var yamlStart = body.indexOf(' ---'); - var yamlEnd = body.indexOf(' ...\n'); - var diag = body.slice(yamlStart, yamlEnd).split('\n').map(function (line) { - return line.slice(2); - }).join('\n'); + var yamlStart = body.indexOf(' ---'); + var yamlEnd = body.indexOf(' ...\n'); + var diag = body.slice(yamlStart, yamlEnd).split('\n').map(function (line) { + return line.slice(2); + }).join('\n'); - // The stack trace and at variable will vary depending on where the code - // is run, so just strip it out. - var withStack = yaml.safeLoad(diag); - delete withStack.stack; - delete withStack.at; - return withStack; + // The stack trace and at variable will vary depending on where the code + // is run, so just strip it out. + var withStack = yaml.safeLoad(diag); + delete withStack.stack; + delete withStack.at; + return withStack; }; // There are three challenges associated with checking the stack traces included @@ -35,45 +35,45 @@ module.exports.getDiag = function (body) { // and replace them with placeholders. var stripChangingData = function (line) { - var withoutTestDir = line.replace(__dirname, '$TEST'); - var withoutPackageDir = withoutTestDir.replace(path.dirname(__dirname), '$TAPE'); - var withoutPathSep = withoutPackageDir.replace(new RegExp('\\' + path.sep, 'g'), '/'); - var withoutLineNumbers = withoutPathSep.replace(/:\d+:\d+/g, ':$LINE:$COL'); - var withoutNestedLineNumbers = withoutLineNumbers.replace(/, :\$LINE:\$COL\)$/, ')'); - return withoutNestedLineNumbers; + var withoutTestDir = line.replace(__dirname, '$TEST'); + var withoutPackageDir = withoutTestDir.replace(path.dirname(__dirname), '$TAPE'); + var withoutPathSep = withoutPackageDir.replace(new RegExp('\\' + path.sep, 'g'), '/'); + var withoutLineNumbers = withoutPathSep.replace(/:\d+:\d+/g, ':$LINE:$COL'); + var withoutNestedLineNumbers = withoutLineNumbers.replace(/, :\$LINE:\$COL\)$/, ')'); + return withoutNestedLineNumbers; }; module.exports.stripFullStack = function (output) { - var stripped = ' [... stack stripped ...]'; - var withDuplicates = output.split(/\r?\n/g).map(stripChangingData).map(function (line) { - var m = line.match(/[ ]{8}at .*\((.*)\)/); + var stripped = ' [... stack stripped ...]'; + var withDuplicates = output.split(/\r?\n/g).map(stripChangingData).map(function (line) { + var m = line.match(/[ ]{8}at .*\((.*)\)/); - if (m && m[1].slice(0, 5) !== '$TEST') { - return stripped; - } - return line; - }); + if (m && m[1].slice(0, 5) !== '$TEST') { + return stripped; + } + return line; + }); - var withoutInternals = withDuplicates.filter(function (line) { - return !line.match(/ \(node:[^)]+\)$/); - }); + var withoutInternals = withDuplicates.filter(function (line) { + return !line.match(/ \(node:[^)]+\)$/); + }); - var deduped = withoutInternals.filter(function (line, ix) { - var hasPrior = line === stripped && withDuplicates[ix - 1] === stripped; - return !hasPrior; - }); + var deduped = withoutInternals.filter(function (line, ix) { + var hasPrior = line === stripped && withDuplicates[ix - 1] === stripped; + return !hasPrior; + }); - return deduped.join('\n').replace( - // Handle stack trace variation in Node v0.8 - /at(:?) Test\.(?:module\.exports|tap\.test\.err\.code)/g, - 'at$1 Test.' - ).replace( - // Handle stack trace variation in Node v0.8 - /at(:?) (Test\.)?tap\.test\.test\.skip/g, - 'at$1 $2' - ).replace( - // Handle stack trace variation in Node v0.8 - /(\[\.\.\. stack stripped \.\.\.\]\r?\n *at) \(([^)]+)\)/g, - '$1 $2' - ).split(/\r?\n/g); + return deduped.join('\n').replace( + // Handle stack trace variation in Node v0.8 + /at(:?) Test\.(?:module\.exports|tap\.test\.err\.code)/g, + 'at$1 Test.' + ).replace( + // Handle stack trace variation in Node v0.8 + /at(:?) (Test\.)?tap\.test\.test\.skip/g, + 'at$1 $2' + ).replace( + // Handle stack trace variation in Node v0.8 + /(\[\.\.\. stack stripped \.\.\.\]\r?\n *at) \(([^)]+)\)/g, + '$1 $2' + ).split(/\r?\n/g); }; diff --git a/test/create_multiple_streams.js b/test/create_multiple_streams.js index 9307e881..965e984a 100644 --- a/test/create_multiple_streams.js +++ b/test/create_multiple_streams.js @@ -3,30 +3,30 @@ var tape = require('../'); tape.test('createMultipleStreams', function (tt) { - tt.plan(2); - - var th = tape.createHarness(); - th.createStream(); - th.createStream(); - - var testOneComplete = false; - - th('test one', function (tht) { - tht.plan(1); - setTimeout(function () { - tht.pass(); - testOneComplete = true; - }, 100); - }); - - th('test two', function (tht) { - tht.ok(testOneComplete, 'test 1 completed before test 2'); - tht.end(); - }); - - th.onFinish(function () { - tt.equal(th._results.count, 2, 'harness test ran'); - tt.equal(th._results.fail, 0, "harness test didn't fail"); - }); + tt.plan(2); + + var th = tape.createHarness(); + th.createStream(); + th.createStream(); + + var testOneComplete = false; + + th('test one', function (tht) { + tht.plan(1); + setTimeout(function () { + tht.pass(); + testOneComplete = true; + }, 100); + }); + + th('test two', function (tht) { + tht.ok(testOneComplete, 'test 1 completed before test 2'); + tht.end(); + }); + + th.onFinish(function () { + tt.equal(th._results.count, 2, 'harness test ran'); + tt.equal(th._results.fail, 0, "harness test didn't fail"); + }); }); diff --git a/test/deep-equal-failure.js b/test/deep-equal-failure.js index c227ff4b..76b0bf56 100644 --- a/test/deep-equal-failure.js +++ b/test/deep-equal-failure.js @@ -10,184 +10,184 @@ var getDiag = common.getDiag; var stripFullStack = common.stripFullStack; tap.test('deep equal failure', function (assert) { - var test = tape.createHarness({ exit: false }); - var stream = test.createStream(); - var parser = tapParser(); - assert.plan(3); - - stream.pipe(parser); - stream.pipe(concat(function (body) { - assert.same(stripFullStack(body.toString('utf8')), [ - 'TAP version 13', - '# deep equal', - 'not ok 1 should be equal', - ' ---', - ' operator: equal', - ' expected: |-', - ' { b: 2 }', - ' actual: |-', - ' { a: 1 }', - ' at: Test. ($TEST/deep-equal-failure.js:$LINE:$COL)', - ' stack: |-', - ' Error: should be equal', - ' [... stack stripped ...]', - ' at Test. ($TEST/deep-equal-failure.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - '', - '1..1', - '# tests 1', - '# pass 0', - '# fail 1', - '' - ]); - - assert.deepEqual(getDiag(body), { - operator: 'equal', - expected: '{ b: 2 }', - actual: '{ a: 1 }' - }); - })); - - parser.once('assert', function (data) { - delete data.diag.stack; - delete data.diag.at; - assert.deepEqual(data, { - ok: false, - id: 1, - name: 'should be equal', - diag: { - operator: 'equal', - expected: '{ b: 2 }', - actual: '{ a: 1 }' - } - }); - }); - - test('deep equal', function (t) { - t.plan(1); - t.equal({ a: 1 }, { b: 2 }); - }); + var test = tape.createHarness({ exit: false }); + var stream = test.createStream(); + var parser = tapParser(); + assert.plan(3); + + stream.pipe(parser); + stream.pipe(concat(function (body) { + assert.same(stripFullStack(body.toString('utf8')), [ + 'TAP version 13', + '# deep equal', + 'not ok 1 should be equal', + ' ---', + ' operator: equal', + ' expected: |-', + ' { b: 2 }', + ' actual: |-', + ' { a: 1 }', + ' at: Test. ($TEST/deep-equal-failure.js:$LINE:$COL)', + ' stack: |-', + ' Error: should be equal', + ' [... stack stripped ...]', + ' at Test. ($TEST/deep-equal-failure.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + '', + '1..1', + '# tests 1', + '# pass 0', + '# fail 1', + '' + ]); + + assert.deepEqual(getDiag(body), { + operator: 'equal', + expected: '{ b: 2 }', + actual: '{ a: 1 }' + }); + })); + + parser.once('assert', function (data) { + delete data.diag.stack; + delete data.diag.at; + assert.deepEqual(data, { + ok: false, + id: 1, + name: 'should be equal', + diag: { + operator: 'equal', + expected: '{ b: 2 }', + actual: '{ a: 1 }' + } + }); + }); + + test('deep equal', function (t) { + t.plan(1); + t.equal({ a: 1 }, { b: 2 }); + }); }); tap.test('deep equal failure, depth 6, with option', function (assert) { - var test = tape.createHarness({ exit: false }); - var stream = test.createStream(); - var parser = tapParser(); - assert.plan(3); - - stream.pipe(parser); - stream.pipe(concat(function (body) { - assert.same(stripFullStack(body.toString('utf8')), [ - 'TAP version 13', - '# deep equal', - 'not ok 1 should be equal', - ' ---', - ' operator: equal', - ' expected: |-', - ' { a: { a1: { a2: { a3: { a4: { a5: 2 } } } } } }', - ' actual: |-', - ' { a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }', - ' at: Test. ($TEST/deep-equal-failure.js:$LINE:$COL)', - ' stack: |-', - ' Error: should be equal', - ' [... stack stripped ...]', - ' at Test. ($TEST/deep-equal-failure.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - '', - '1..1', - '# tests 1', - '# pass 0', - '# fail 1', - '' - ]); - - assert.deepEqual(getDiag(body), { - operator: 'equal', - expected: '{ a: { a1: { a2: { a3: { a4: { a5: 2 } } } } } }', - actual: '{ a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }' - }); - })); - - parser.once('assert', function (data) { - delete data.diag.stack; - delete data.diag.at; - assert.deepEqual(data, { - ok: false, - id: 1, - name: 'should be equal', - diag: { - operator: 'equal', - expected: '{ a: { a1: { a2: { a3: { a4: { a5: 2 } } } } } }', - actual: '{ a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }' - } - }); - }); - - test('deep equal', { objectPrintDepth: 6 }, function (t) { - t.plan(1); - t.equal({ a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }, { a: { a1: { a2: { a3: { a4: { a5: 2 } } } } } }); - }); + var test = tape.createHarness({ exit: false }); + var stream = test.createStream(); + var parser = tapParser(); + assert.plan(3); + + stream.pipe(parser); + stream.pipe(concat(function (body) { + assert.same(stripFullStack(body.toString('utf8')), [ + 'TAP version 13', + '# deep equal', + 'not ok 1 should be equal', + ' ---', + ' operator: equal', + ' expected: |-', + ' { a: { a1: { a2: { a3: { a4: { a5: 2 } } } } } }', + ' actual: |-', + ' { a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }', + ' at: Test. ($TEST/deep-equal-failure.js:$LINE:$COL)', + ' stack: |-', + ' Error: should be equal', + ' [... stack stripped ...]', + ' at Test. ($TEST/deep-equal-failure.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + '', + '1..1', + '# tests 1', + '# pass 0', + '# fail 1', + '' + ]); + + assert.deepEqual(getDiag(body), { + operator: 'equal', + expected: '{ a: { a1: { a2: { a3: { a4: { a5: 2 } } } } } }', + actual: '{ a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }' + }); + })); + + parser.once('assert', function (data) { + delete data.diag.stack; + delete data.diag.at; + assert.deepEqual(data, { + ok: false, + id: 1, + name: 'should be equal', + diag: { + operator: 'equal', + expected: '{ a: { a1: { a2: { a3: { a4: { a5: 2 } } } } } }', + actual: '{ a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }' + } + }); + }); + + test('deep equal', { objectPrintDepth: 6 }, function (t) { + t.plan(1); + t.equal({ a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }, { a: { a1: { a2: { a3: { a4: { a5: 2 } } } } } }); + }); }); tap.test('deep equal failure, depth 6, without option', function (assert) { - var test = tape.createHarness({ exit: false }); - var stream = test.createStream(); - var parser = tapParser(); - assert.plan(3); - - stream.pipe(parser); - stream.pipe(concat(function (body) { - assert.same(stripFullStack(body.toString('utf8')), [ - 'TAP version 13', - '# deep equal', - 'not ok 1 should be equal', - ' ---', - ' operator: equal', - ' expected: |-', - ' { a: { a1: { a2: { a3: { a4: [Object] } } } } }', - ' actual: |-', - ' { a: { a1: { a2: { a3: { a4: [Object] } } } } }', - ' at: Test. ($TEST/deep-equal-failure.js:$LINE:$COL)', - ' stack: |-', - ' Error: should be equal', - ' [... stack stripped ...]', - ' at Test. ($TEST/deep-equal-failure.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - '', - '1..1', - '# tests 1', - '# pass 0', - '# fail 1', - '' - ]); - - assert.deepEqual(getDiag(body), { - operator: 'equal', - expected: '{ a: { a1: { a2: { a3: { a4: [Object] } } } } }', - actual: '{ a: { a1: { a2: { a3: { a4: [Object] } } } } }' - }); - })); - - parser.once('assert', function (data) { - delete data.diag.stack; - delete data.diag.at; - assert.deepEqual(data, { - ok: false, - id: 1, - name: 'should be equal', - diag: { - operator: 'equal', - expected: '{ a: { a1: { a2: { a3: { a4: [Object] } } } } }', - actual: '{ a: { a1: { a2: { a3: { a4: [Object] } } } } }' - } - }); - }); - - test('deep equal', function (t) { - t.plan(1); - t.equal({ a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }, { a: { a1: { a2: { a3: { a4: { a5: 2 } } } } } }); - }); + var test = tape.createHarness({ exit: false }); + var stream = test.createStream(); + var parser = tapParser(); + assert.plan(3); + + stream.pipe(parser); + stream.pipe(concat(function (body) { + assert.same(stripFullStack(body.toString('utf8')), [ + 'TAP version 13', + '# deep equal', + 'not ok 1 should be equal', + ' ---', + ' operator: equal', + ' expected: |-', + ' { a: { a1: { a2: { a3: { a4: [Object] } } } } }', + ' actual: |-', + ' { a: { a1: { a2: { a3: { a4: [Object] } } } } }', + ' at: Test. ($TEST/deep-equal-failure.js:$LINE:$COL)', + ' stack: |-', + ' Error: should be equal', + ' [... stack stripped ...]', + ' at Test. ($TEST/deep-equal-failure.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + '', + '1..1', + '# tests 1', + '# pass 0', + '# fail 1', + '' + ]); + + assert.deepEqual(getDiag(body), { + operator: 'equal', + expected: '{ a: { a1: { a2: { a3: { a4: [Object] } } } } }', + actual: '{ a: { a1: { a2: { a3: { a4: [Object] } } } } }' + }); + })); + + parser.once('assert', function (data) { + delete data.diag.stack; + delete data.diag.at; + assert.deepEqual(data, { + ok: false, + id: 1, + name: 'should be equal', + diag: { + operator: 'equal', + expected: '{ a: { a1: { a2: { a3: { a4: [Object] } } } } }', + actual: '{ a: { a1: { a2: { a3: { a4: [Object] } } } } }' + } + }); + }); + + test('deep equal', function (t) { + t.plan(1); + t.equal({ a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }, { a: { a1: { a2: { a3: { a4: { a5: 2 } } } } } }); + }); }); diff --git a/test/deep.js b/test/deep.js index c5820043..eb9f6831 100644 --- a/test/deep.js +++ b/test/deep.js @@ -3,17 +3,17 @@ var test = require('../'); test('deep strict equal', function (t) { - t.notDeepEqual( - [{ a: '3' }], - [{ a: 3 }] - ); - t.end(); + t.notDeepEqual( + [{ a: '3' }], + [{ a: 3 }] + ); + t.end(); }); test('deep loose equal', function (t) { - t.deepLooseEqual( - [{ a: '3' }], - [{ a: 3 }] - ); - t.end(); + t.deepLooseEqual( + [{ a: '3' }], + [{ a: 3 }] + ); + t.end(); }); diff --git a/test/default-messages.js b/test/default-messages.js index 799bb2f7..1be07e0a 100644 --- a/test/default-messages.js +++ b/test/default-messages.js @@ -8,44 +8,44 @@ var concat = require('concat-stream'); var stripFullStack = require('./common').stripFullStack; tap.test('default messages', function (t) { - t.plan(1); + t.plan(1); - var ps = spawn(process.execPath, [path.join(__dirname, 'messages', 'defaults.js')]); + var ps = spawn(process.execPath, [path.join(__dirname, 'messages', 'defaults.js')]); - ps.stdout.pipe(concat(function (rows) { - t.same(stripFullStack(rows.toString('utf8')), [ - 'TAP version 13', - '# default messages', - 'ok 1 should be truthy', - 'ok 2 should be falsy', - 'ok 3 should be equal', - 'ok 4 should not be equal', - 'ok 5 should be equivalent', - 'ok 6 should be equivalent', - 'ok 7 should be equal', - 'ok 8 should not be equal', - 'ok 9 should be equivalent', - 'not ok 10 should not be equivalent', - ' ---', - ' operator: notDeepEqual', - ' expected: true', - ' actual: true', - ' at: Test. ($TEST/messages/defaults.js:$LINE:$COL)', - ' stack: |-', - ' Error: should not be equivalent', - ' [... stack stripped ...]', - ' at Test. ($TEST/messages/defaults.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'ok 11 should be equivalent', - 'ok 12 should be equivalent', - '', - '1..12', - '# tests 12', - '# pass 11', - '# fail 1', - '', - '' - ]); - })); + ps.stdout.pipe(concat(function (rows) { + t.same(stripFullStack(rows.toString('utf8')), [ + 'TAP version 13', + '# default messages', + 'ok 1 should be truthy', + 'ok 2 should be falsy', + 'ok 3 should be equal', + 'ok 4 should not be equal', + 'ok 5 should be equivalent', + 'ok 6 should be equivalent', + 'ok 7 should be equal', + 'ok 8 should not be equal', + 'ok 9 should be equivalent', + 'not ok 10 should not be equivalent', + ' ---', + ' operator: notDeepEqual', + ' expected: true', + ' actual: true', + ' at: Test. ($TEST/messages/defaults.js:$LINE:$COL)', + ' stack: |-', + ' Error: should not be equivalent', + ' [... stack stripped ...]', + ' at Test. ($TEST/messages/defaults.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'ok 11 should be equivalent', + 'ok 12 should be equivalent', + '', + '1..12', + '# tests 12', + '# pass 11', + '# fail 1', + '', + '' + ]); + })); }); diff --git a/test/double_end.js b/test/double_end.js index 64edb526..aeea7256 100644 --- a/test/double_end.js +++ b/test/double_end.js @@ -8,55 +8,55 @@ var spawn = require('child_process').spawn; var stripFullStack = require('./common').stripFullStack; test(function (t) { - t.plan(2); - var ps = spawn(process.execPath, [path.join(__dirname, 'double_end', 'double.js')]); - ps.on('exit', function (code) { - t.equal(code, 1); - }); - ps.stdout.pipe(concat(function (body) { - // The implementation of node's timer library has changed over time. We - // need to reverse engineer the error we expect to see. + t.plan(2); + var ps = spawn(process.execPath, [path.join(__dirname, 'double_end', 'double.js')]); + ps.on('exit', function (code) { + t.equal(code, 1); + }); + ps.stdout.pipe(concat(function (body) { + // The implementation of node's timer library has changed over time. We + // need to reverse engineer the error we expect to see. - // This code is unfortunately by necessity highly coupled to node - // versions, and may require tweaking with future versions of the timers - // library. - function doEnd() { throw new Error(); } - var to = setTimeout(doEnd, 5000); - clearTimeout(to); - to._onTimeout = doEnd; + // This code is unfortunately by necessity highly coupled to node + // versions, and may require tweaking with future versions of the timers + // library. + function doEnd() { throw new Error(); } + var to = setTimeout(doEnd, 5000); + clearTimeout(to); + to._onTimeout = doEnd; - var stackExpected; - var atExpected; - try { - to._onTimeout(); - } catch (e) { - stackExpected = stripFullStack(e.stack)[1]; - stackExpected = stackExpected.replace('double_end.js', 'double_end/double.js'); - stackExpected = stackExpected.trim(); - atExpected = stackExpected.replace(/^at\s+/, 'at: '); - } + var stackExpected; + var atExpected; + try { + to._onTimeout(); + } catch (e) { + stackExpected = stripFullStack(e.stack)[1]; + stackExpected = stackExpected.replace('double_end.js', 'double_end/double.js'); + stackExpected = stackExpected.trim(); + atExpected = stackExpected.replace(/^at\s+/, 'at: '); + } - t.same(stripFullStack(body.toString('utf8')), [ - 'TAP version 13', - '# double end', - 'ok 1 should be equal', - 'not ok 2 .end() already called', - ' ---', - ' operator: fail', - ' ' + atExpected, - ' stack: |-', - ' Error: .end() already called', - ' [... stack stripped ...]', - ' ' + stackExpected, - ' [... stack stripped ...]', - ' ...', - '', - '1..2', - '# tests 2', - '# pass 1', - '# fail 1', - '', - '' - ]); - })); + t.same(stripFullStack(body.toString('utf8')), [ + 'TAP version 13', + '# double end', + 'ok 1 should be equal', + 'not ok 2 .end() already called', + ' ---', + ' operator: fail', + ' ' + atExpected, + ' stack: |-', + ' Error: .end() already called', + ' [... stack stripped ...]', + ' ' + stackExpected, + ' [... stack stripped ...]', + ' ...', + '', + '1..2', + '# tests 2', + '# pass 1', + '# fail 1', + '', + '' + ]); + })); }); diff --git a/test/double_end/double.js b/test/double_end/double.js index 2c0ae405..1a4d470d 100644 --- a/test/double_end/double.js +++ b/test/double_end/double.js @@ -3,11 +3,11 @@ var test = require('../../'); test('double end', function (t) { - function doEnd() { - t.end(); - } + function doEnd() { + t.end(); + } - t.equal(1 + 1, 2); - t.end(); - setTimeout(doEnd, 5); + t.equal(1 + 1, 2); + t.end(); + setTimeout(doEnd, 5); }); diff --git a/test/edge-cases.js b/test/edge-cases.js index 78ea70d6..56ec6304 100644 --- a/test/edge-cases.js +++ b/test/edge-cases.js @@ -7,283 +7,283 @@ var concat = require('concat-stream'); var stripFullStack = require('./common').stripFullStack; tap.test('edge cases', function (tt) { - tt.plan(1); + tt.plan(1); - var test = tape.createHarness(); - test.createStream().pipe(concat(function (body) { - tt.same(stripFullStack(body.toString('utf8')), [ - 'TAP version 13', - '# zeroes', - 'ok 1 0 equal to -0', - 'ok 2 -0 equal to 0', - 'not ok 3 0 notEqual to -0', - ' ---', - ' operator: notEqual', - ' expected: |-', - ' -0', - ' actual: |-', - ' 0', - ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' stack: |-', - ' Error: 0 notEqual to -0', - ' [... stack stripped ...]', - ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 4 -0 notEqual to 0', - ' ---', - ' operator: notEqual', - ' expected: |-', - ' 0', - ' actual: |-', - ' -0', - ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' stack: |-', - ' Error: -0 notEqual to 0', - ' [... stack stripped ...]', - ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'ok 5 0 looseEqual to -0', - 'ok 6 -0 looseEqual to 0', - 'not ok 7 0 notLooseEqual to -0', - ' ---', - ' operator: notDeepLooseEqual', - ' expected: |-', - ' -0', - ' actual: |-', - ' 0', - ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' stack: |-', - ' Error: 0 notLooseEqual to -0', - ' [... stack stripped ...]', - ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 8 -0 notLooseEqual to 0', - ' ---', - ' operator: notDeepLooseEqual', - ' expected: |-', - ' 0', - ' actual: |-', - ' -0', - ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' stack: |-', - ' Error: -0 notLooseEqual to 0', - ' [... stack stripped ...]', - ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'ok 9 0 strictEqual to -0', - 'ok 10 -0 strictEqual to 0', - 'not ok 11 0 notStrictEqual to -0', - ' ---', - ' operator: notEqual', - ' expected: |-', - ' -0', - ' actual: |-', - ' 0', - ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' stack: |-', - ' Error: 0 notStrictEqual to -0', - ' [... stack stripped ...]', - ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 12 -0 notStrictEqual to 0', - ' ---', - ' operator: notEqual', - ' expected: |-', - ' 0', - ' actual: |-', - ' -0', - ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' stack: |-', - ' Error: -0 notStrictEqual to 0', - ' [... stack stripped ...]', - ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'ok 13 0 deepLooseEqual to -0', - 'ok 14 -0 deepLooseEqual to 0', - 'not ok 15 0 notDeepLooseEqual to -0', - ' ---', - ' operator: notDeepLooseEqual', - ' expected: |-', - ' -0', - ' actual: |-', - ' 0', - ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' stack: |-', - ' Error: 0 notDeepLooseEqual to -0', - ' [... stack stripped ...]', - ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 16 -0 notDeepLooseEqual to 0', - ' ---', - ' operator: notDeepLooseEqual', - ' expected: |-', - ' 0', - ' actual: |-', - ' -0', - ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' stack: |-', - ' Error: -0 notDeepLooseEqual to 0', - ' [... stack stripped ...]', - ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 17 0 deepEqual to -0', - ' ---', - ' operator: deepEqual', - ' expected: |-', - ' -0', - ' actual: |-', - ' 0', - ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' stack: |-', - ' Error: 0 deepEqual to -0', - ' [... stack stripped ...]', - ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 18 -0 deepEqual to 0', - ' ---', - ' operator: deepEqual', - ' expected: |-', - ' 0', - ' actual: |-', - ' -0', - ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' stack: |-', - ' Error: -0 deepEqual to 0', - ' [... stack stripped ...]', - ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'ok 19 0 notDeepEqual to -0', - 'ok 20 -0 notDeepEqual to 0', - '# NaNs', - 'not ok 21 NaN equal to NaN', - ' ---', - ' operator: equal', - ' expected: NaN', - ' actual: NaN', - ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' stack: |-', - ' Error: NaN equal to NaN', - ' [... stack stripped ...]', - ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'ok 22 NaN notEqual to NaN', - 'not ok 23 NaN looseEqual to NaN', - ' ---', - ' operator: deepLooseEqual', - ' expected: NaN', - ' actual: NaN', - ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' stack: |-', - ' Error: NaN looseEqual to NaN', - ' [... stack stripped ...]', - ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'ok 24 NaN notLooseEqual to NaN', - 'not ok 25 NaN strictEqual to NaN', - ' ---', - ' operator: equal', - ' expected: NaN', - ' actual: NaN', - ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' stack: |-', - ' Error: NaN strictEqual to NaN', - ' [... stack stripped ...]', - ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'ok 26 NaN notStrictEqual to NaN', - 'not ok 27 NaN deepLooseEqual to NaN', - ' ---', - ' operator: deepLooseEqual', - ' expected: NaN', - ' actual: NaN', - ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' stack: |-', - ' Error: NaN deepLooseEqual to NaN', - ' [... stack stripped ...]', - ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'ok 28 NaN notDeepLooseEqual to NaN', - 'ok 29 NaN deepEqual to NaN', - 'not ok 30 NaN notDeepEqual to NaN', - ' ---', - ' operator: notDeepEqual', - ' expected: NaN', - ' actual: NaN', - ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' stack: |-', - ' Error: NaN notDeepEqual to NaN', - ' [... stack stripped ...]', - ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - '', - '1..30', - '# tests 30', - '# pass 15', - '# fail 15', - '' - ]); - })); + var test = tape.createHarness(); + test.createStream().pipe(concat(function (body) { + tt.same(stripFullStack(body.toString('utf8')), [ + 'TAP version 13', + '# zeroes', + 'ok 1 0 equal to -0', + 'ok 2 -0 equal to 0', + 'not ok 3 0 notEqual to -0', + ' ---', + ' operator: notEqual', + ' expected: |-', + ' -0', + ' actual: |-', + ' 0', + ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' stack: |-', + ' Error: 0 notEqual to -0', + ' [... stack stripped ...]', + ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 4 -0 notEqual to 0', + ' ---', + ' operator: notEqual', + ' expected: |-', + ' 0', + ' actual: |-', + ' -0', + ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' stack: |-', + ' Error: -0 notEqual to 0', + ' [... stack stripped ...]', + ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'ok 5 0 looseEqual to -0', + 'ok 6 -0 looseEqual to 0', + 'not ok 7 0 notLooseEqual to -0', + ' ---', + ' operator: notDeepLooseEqual', + ' expected: |-', + ' -0', + ' actual: |-', + ' 0', + ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' stack: |-', + ' Error: 0 notLooseEqual to -0', + ' [... stack stripped ...]', + ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 8 -0 notLooseEqual to 0', + ' ---', + ' operator: notDeepLooseEqual', + ' expected: |-', + ' 0', + ' actual: |-', + ' -0', + ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' stack: |-', + ' Error: -0 notLooseEqual to 0', + ' [... stack stripped ...]', + ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'ok 9 0 strictEqual to -0', + 'ok 10 -0 strictEqual to 0', + 'not ok 11 0 notStrictEqual to -0', + ' ---', + ' operator: notEqual', + ' expected: |-', + ' -0', + ' actual: |-', + ' 0', + ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' stack: |-', + ' Error: 0 notStrictEqual to -0', + ' [... stack stripped ...]', + ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 12 -0 notStrictEqual to 0', + ' ---', + ' operator: notEqual', + ' expected: |-', + ' 0', + ' actual: |-', + ' -0', + ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' stack: |-', + ' Error: -0 notStrictEqual to 0', + ' [... stack stripped ...]', + ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'ok 13 0 deepLooseEqual to -0', + 'ok 14 -0 deepLooseEqual to 0', + 'not ok 15 0 notDeepLooseEqual to -0', + ' ---', + ' operator: notDeepLooseEqual', + ' expected: |-', + ' -0', + ' actual: |-', + ' 0', + ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' stack: |-', + ' Error: 0 notDeepLooseEqual to -0', + ' [... stack stripped ...]', + ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 16 -0 notDeepLooseEqual to 0', + ' ---', + ' operator: notDeepLooseEqual', + ' expected: |-', + ' 0', + ' actual: |-', + ' -0', + ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' stack: |-', + ' Error: -0 notDeepLooseEqual to 0', + ' [... stack stripped ...]', + ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 17 0 deepEqual to -0', + ' ---', + ' operator: deepEqual', + ' expected: |-', + ' -0', + ' actual: |-', + ' 0', + ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' stack: |-', + ' Error: 0 deepEqual to -0', + ' [... stack stripped ...]', + ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 18 -0 deepEqual to 0', + ' ---', + ' operator: deepEqual', + ' expected: |-', + ' 0', + ' actual: |-', + ' -0', + ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' stack: |-', + ' Error: -0 deepEqual to 0', + ' [... stack stripped ...]', + ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'ok 19 0 notDeepEqual to -0', + 'ok 20 -0 notDeepEqual to 0', + '# NaNs', + 'not ok 21 NaN equal to NaN', + ' ---', + ' operator: equal', + ' expected: NaN', + ' actual: NaN', + ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' stack: |-', + ' Error: NaN equal to NaN', + ' [... stack stripped ...]', + ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'ok 22 NaN notEqual to NaN', + 'not ok 23 NaN looseEqual to NaN', + ' ---', + ' operator: deepLooseEqual', + ' expected: NaN', + ' actual: NaN', + ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' stack: |-', + ' Error: NaN looseEqual to NaN', + ' [... stack stripped ...]', + ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'ok 24 NaN notLooseEqual to NaN', + 'not ok 25 NaN strictEqual to NaN', + ' ---', + ' operator: equal', + ' expected: NaN', + ' actual: NaN', + ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' stack: |-', + ' Error: NaN strictEqual to NaN', + ' [... stack stripped ...]', + ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'ok 26 NaN notStrictEqual to NaN', + 'not ok 27 NaN deepLooseEqual to NaN', + ' ---', + ' operator: deepLooseEqual', + ' expected: NaN', + ' actual: NaN', + ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' stack: |-', + ' Error: NaN deepLooseEqual to NaN', + ' [... stack stripped ...]', + ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'ok 28 NaN notDeepLooseEqual to NaN', + 'ok 29 NaN deepEqual to NaN', + 'not ok 30 NaN notDeepEqual to NaN', + ' ---', + ' operator: notDeepEqual', + ' expected: NaN', + ' actual: NaN', + ' at: Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' stack: |-', + ' Error: NaN notDeepEqual to NaN', + ' [... stack stripped ...]', + ' at Test. ($TEST/edge-cases.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + '', + '1..30', + '# tests 30', + '# pass 15', + '# fail 15', + '' + ]); + })); - test('zeroes', function (t) { - t.equal(0, -0, '0 equal to -0'); - t.equal(-0, 0, '-0 equal to 0'); - t.notEqual(0, -0, '0 notEqual to -0'); - t.notEqual(-0, 0, '-0 notEqual to 0'); + test('zeroes', function (t) { + t.equal(0, -0, '0 equal to -0'); + t.equal(-0, 0, '-0 equal to 0'); + t.notEqual(0, -0, '0 notEqual to -0'); + t.notEqual(-0, 0, '-0 notEqual to 0'); - t.looseEqual(0, -0, '0 looseEqual to -0'); - t.looseEqual(-0, 0, '-0 looseEqual to 0'); - t.notLooseEqual(0, -0, '0 notLooseEqual to -0'); - t.notLooseEqual(-0, 0, '-0 notLooseEqual to 0'); + t.looseEqual(0, -0, '0 looseEqual to -0'); + t.looseEqual(-0, 0, '-0 looseEqual to 0'); + t.notLooseEqual(0, -0, '0 notLooseEqual to -0'); + t.notLooseEqual(-0, 0, '-0 notLooseEqual to 0'); - t.strictEqual(0, -0, '0 strictEqual to -0'); - t.strictEqual(-0, 0, '-0 strictEqual to 0'); - t.notStrictEqual(0, -0, '0 notStrictEqual to -0'); - t.notStrictEqual(-0, 0, '-0 notStrictEqual to 0'); + t.strictEqual(0, -0, '0 strictEqual to -0'); + t.strictEqual(-0, 0, '-0 strictEqual to 0'); + t.notStrictEqual(0, -0, '0 notStrictEqual to -0'); + t.notStrictEqual(-0, 0, '-0 notStrictEqual to 0'); - t.deepLooseEqual(0, -0, '0 deepLooseEqual to -0'); - t.deepLooseEqual(-0, 0, '-0 deepLooseEqual to 0'); - t.notDeepLooseEqual(0, -0, '0 notDeepLooseEqual to -0'); - t.notDeepLooseEqual(-0, 0, '-0 notDeepLooseEqual to 0'); + t.deepLooseEqual(0, -0, '0 deepLooseEqual to -0'); + t.deepLooseEqual(-0, 0, '-0 deepLooseEqual to 0'); + t.notDeepLooseEqual(0, -0, '0 notDeepLooseEqual to -0'); + t.notDeepLooseEqual(-0, 0, '-0 notDeepLooseEqual to 0'); - t.deepEqual(0, -0, '0 deepEqual to -0'); - t.deepEqual(-0, 0, '-0 deepEqual to 0'); - t.notDeepEqual(0, -0, '0 notDeepEqual to -0'); - t.notDeepEqual(-0, 0, '-0 notDeepEqual to 0'); + t.deepEqual(0, -0, '0 deepEqual to -0'); + t.deepEqual(-0, 0, '-0 deepEqual to 0'); + t.notDeepEqual(0, -0, '0 notDeepEqual to -0'); + t.notDeepEqual(-0, 0, '-0 notDeepEqual to 0'); - t.end(); - }); + t.end(); + }); - test('NaNs', function (t) { - t.equal(NaN, NaN, 'NaN equal to NaN'); - t.notEqual(NaN, NaN, 'NaN notEqual to NaN'); + test('NaNs', function (t) { + t.equal(NaN, NaN, 'NaN equal to NaN'); + t.notEqual(NaN, NaN, 'NaN notEqual to NaN'); - t.looseEqual(NaN, NaN, 'NaN looseEqual to NaN'); - t.notLooseEqual(NaN, NaN, 'NaN notLooseEqual to NaN'); + t.looseEqual(NaN, NaN, 'NaN looseEqual to NaN'); + t.notLooseEqual(NaN, NaN, 'NaN notLooseEqual to NaN'); - t.strictEqual(NaN, NaN, 'NaN strictEqual to NaN'); - t.notStrictEqual(NaN, NaN, 'NaN notStrictEqual to NaN'); + t.strictEqual(NaN, NaN, 'NaN strictEqual to NaN'); + t.notStrictEqual(NaN, NaN, 'NaN notStrictEqual to NaN'); - t.deepLooseEqual(NaN, NaN, 'NaN deepLooseEqual to NaN'); - t.notDeepLooseEqual(NaN, NaN, 'NaN notDeepLooseEqual to NaN'); + t.deepLooseEqual(NaN, NaN, 'NaN deepLooseEqual to NaN'); + t.notDeepLooseEqual(NaN, NaN, 'NaN notDeepLooseEqual to NaN'); - t.deepEqual(NaN, NaN, 'NaN deepEqual to NaN'); - t.notDeepEqual(NaN, NaN, 'NaN notDeepEqual to NaN'); + t.deepEqual(NaN, NaN, 'NaN deepEqual to NaN'); + t.notDeepEqual(NaN, NaN, 'NaN notDeepEqual to NaN'); - t.end(); - }); + t.end(); + }); }); diff --git a/test/end-as-callback.js b/test/end-as-callback.js index 301cad50..af7babad 100644 --- a/test/end-as-callback.js +++ b/test/end-as-callback.js @@ -6,57 +6,57 @@ var tape = require('../'); var concat = require('concat-stream'); tap.test('tape assert.end as callback', function (tt) { - var test = tape.createHarness({ exit: false }); + var test = tape.createHarness({ exit: false }); - test.createStream().pipe(concat(function (rows) { - tt.equal(rows.toString('utf8'), [ - 'TAP version 13', - '# do a task and write', - 'ok 1 null', - 'ok 2 should be equal', - '# do a task and write fail', - 'ok 3 null', - 'ok 4 should be equal', - 'not ok 5 Error: fail', - getStackTrace(rows), // tap error stack - '', - '1..5', - '# tests 5', - '# pass 4', - '# fail 1' - ].join('\n') + '\n'); - tt.end(); - })); + test.createStream().pipe(concat(function (rows) { + tt.equal(rows.toString('utf8'), [ + 'TAP version 13', + '# do a task and write', + 'ok 1 null', + 'ok 2 should be equal', + '# do a task and write fail', + 'ok 3 null', + 'ok 4 should be equal', + 'not ok 5 Error: fail', + getStackTrace(rows), // tap error stack + '', + '1..5', + '# tests 5', + '# pass 4', + '# fail 1' + ].join('\n') + '\n'); + tt.end(); + })); - test('do a task and write', function (assert) { - fakeAsyncTask('foo', function (err, value) { - assert.ifError(err); - assert.equal(value, 'taskfoo'); + test('do a task and write', function (assert) { + fakeAsyncTask('foo', function (err, value) { + assert.ifError(err); + assert.equal(value, 'taskfoo'); - fakeAsyncWrite('bar', assert.end); - }); - }); + fakeAsyncWrite('bar', assert.end); + }); + }); - test('do a task and write fail', function (assert) { - fakeAsyncTask('bar', function (err, value) { - assert.ifError(err); - assert.equal(value, 'taskbar'); + test('do a task and write fail', function (assert) { + fakeAsyncTask('bar', function (err, value) { + assert.ifError(err); + assert.equal(value, 'taskbar'); - fakeAsyncWriteFail('baz', assert.end); - }); - }); + fakeAsyncWriteFail('baz', assert.end); + }); + }); }); function fakeAsyncTask(name, cb) { - cb(null, 'task' + name); + cb(null, 'task' + name); } function fakeAsyncWrite(name, cb) { - cb(null); + cb(null); } function fakeAsyncWriteFail(name, cb) { - cb(new Error('fail')); + cb(new Error('fail')); } /** @@ -68,20 +68,20 @@ function fakeAsyncWriteFail(name, cb) { * @returns String stacktrace - just the error stack part */ function getStackTrace(rows) { - var stacktrace = ' ---\n'; - var extract = false; - forEach(rows.toString('utf8').split('\n'), function (row) { - if (!extract) { - if (row.indexOf('---') > -1) { // start of stack trace - extract = true; - } - } else if (row.indexOf('...') > -1) { // end of stack trace - extract = false; - stacktrace += ' ...'; - } else { - stacktrace += row + '\n'; - } - }); - // console.log(stacktrace); - return stacktrace; + var stacktrace = ' ---\n'; + var extract = false; + forEach(rows.toString('utf8').split('\n'), function (row) { + if (!extract) { + if (row.indexOf('---') > -1) { // start of stack trace + extract = true; + } + } else if (row.indexOf('...') > -1) { // end of stack trace + extract = false; + stacktrace += ' ...'; + } else { + stacktrace += row + '\n'; + } + }); + // console.log(stacktrace); + return stacktrace; } diff --git a/test/error.js b/test/error.js index 18dcb0bd..26acc09c 100644 --- a/test/error.js +++ b/test/error.js @@ -7,37 +7,37 @@ var concat = require('concat-stream'); var stripFullStack = require('./common').stripFullStack; tap.test('failures', function (tt) { - tt.plan(1); + tt.plan(1); - var test = tape.createHarness(); - test.createStream().pipe(concat(function (body) { - tt.same(stripFullStack(body.toString('utf8')), [ - 'TAP version 13', - '# error', - 'not ok 1 Error: this is a message', - ' ---', - ' operator: error', - ' expected: |-', - ' undefined', - ' actual: |-', - ' [Error: this is a message]', - ' at: Test. ($TEST/error.js:$LINE:$COL)', - ' stack: |-', - ' Error: this is a message', - ' at Test. ($TEST/error.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - '', - '1..1', - '# tests 1', - '# pass 0', - '# fail 1', - '' - ]); - })); + var test = tape.createHarness(); + test.createStream().pipe(concat(function (body) { + tt.same(stripFullStack(body.toString('utf8')), [ + 'TAP version 13', + '# error', + 'not ok 1 Error: this is a message', + ' ---', + ' operator: error', + ' expected: |-', + ' undefined', + ' actual: |-', + ' [Error: this is a message]', + ' at: Test. ($TEST/error.js:$LINE:$COL)', + ' stack: |-', + ' Error: this is a message', + ' at Test. ($TEST/error.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + '', + '1..1', + '# tests 1', + '# pass 0', + '# fail 1', + '' + ]); + })); - test('error', function (t) { - t.plan(1); - t.error(new Error('this is a message')); - }); + test('error', function (t) { + t.plan(1); + t.error(new Error('this is a message')); + }); }); diff --git a/test/exit.js b/test/exit.js index 7c528666..6bd73f48 100644 --- a/test/exit.js +++ b/test/exit.js @@ -8,244 +8,244 @@ var concat = require('concat-stream'); var stripFullStack = require('./common').stripFullStack; tap.test('exit ok', function (t) { - t.plan(2); - - var tc = function (rows) { - t.same(rows.toString('utf8'), [ - 'TAP version 13', - '# array', - '# hi', - 'ok 1 should be equivalent', - 'ok 2 should be equivalent', - 'ok 3 should be equivalent', - 'ok 4 should be equivalent', - 'ok 5 should be equivalent', - '', - '1..5', - '# tests 5', - '# pass 5', - '', - '# ok', - '', // yes, these double-blank-lines at the end are required. - '' // if you can figure out how to remove them, please do! - ].join('\n')); - }; - - var ps = spawn(process.execPath, [path.join(__dirname, 'exit', 'ok.js')]); - ps.stdout.pipe(concat(tc)); - ps.on('exit', function (code) { - t.equal(code, 0); - }); + t.plan(2); + + var tc = function (rows) { + t.same(rows.toString('utf8'), [ + 'TAP version 13', + '# array', + '# hi', + 'ok 1 should be equivalent', + 'ok 2 should be equivalent', + 'ok 3 should be equivalent', + 'ok 4 should be equivalent', + 'ok 5 should be equivalent', + '', + '1..5', + '# tests 5', + '# pass 5', + '', + '# ok', + '', // yes, these double-blank-lines at the end are required. + '' // if you can figure out how to remove them, please do! + ].join('\n')); + }; + + var ps = spawn(process.execPath, [path.join(__dirname, 'exit', 'ok.js')]); + ps.stdout.pipe(concat(tc)); + ps.on('exit', function (code) { + t.equal(code, 0); + }); }); tap.test('exit fail', function (t) { - t.plan(2); - - var tc = function (rows) { - t.same(stripFullStack(rows.toString('utf8')), [ - 'TAP version 13', - '# array', - 'ok 1 should be equivalent', - 'ok 2 should be equivalent', - 'ok 3 should be equivalent', - 'ok 4 should be equivalent', - 'not ok 5 should be equivalent', - ' ---', - ' operator: deepEqual', - ' expected: [ [ 1, 2, [ 3, 4444 ] ], [ 5, 6 ] ]', - ' actual: [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]', - ' at: ($TEST/exit/fail.js:$LINE:$COL)', - ' stack: |-', - ' Error: should be equivalent', - ' [... stack stripped ...]', - ' at $TEST/exit/fail.js:$LINE:$COL', - ' at eval (eval at ($TEST/exit/fail.js:$LINE:$COL))', - ' at eval (eval at ($TEST/exit/fail.js:$LINE:$COL))', - ' at Test. ($TEST/exit/fail.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - '', - '1..5', - '# tests 5', - '# pass 4', - '# fail 1', - '', - '' - ]); - }; - - var ps = spawn(process.execPath, [path.join(__dirname, 'exit', 'fail.js')]); - ps.stdout.pipe(concat(tc)); - ps.on('exit', function (code) { - t.notEqual(code, 0); - }); + t.plan(2); + + var tc = function (rows) { + t.same(stripFullStack(rows.toString('utf8')), [ + 'TAP version 13', + '# array', + 'ok 1 should be equivalent', + 'ok 2 should be equivalent', + 'ok 3 should be equivalent', + 'ok 4 should be equivalent', + 'not ok 5 should be equivalent', + ' ---', + ' operator: deepEqual', + ' expected: [ [ 1, 2, [ 3, 4444 ] ], [ 5, 6 ] ]', + ' actual: [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]', + ' at: ($TEST/exit/fail.js:$LINE:$COL)', + ' stack: |-', + ' Error: should be equivalent', + ' [... stack stripped ...]', + ' at $TEST/exit/fail.js:$LINE:$COL', + ' at eval (eval at ($TEST/exit/fail.js:$LINE:$COL))', + ' at eval (eval at ($TEST/exit/fail.js:$LINE:$COL))', + ' at Test. ($TEST/exit/fail.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + '', + '1..5', + '# tests 5', + '# pass 4', + '# fail 1', + '', + '' + ]); + }; + + var ps = spawn(process.execPath, [path.join(__dirname, 'exit', 'fail.js')]); + ps.stdout.pipe(concat(tc)); + ps.on('exit', function (code) { + t.notEqual(code, 0); + }); }); tap.test('too few exit', function (t) { - t.plan(2); - - var tc = function (rows) { - t.same(stripFullStack(rows.toString('utf8')), [ - 'TAP version 13', - '# array', - 'ok 1 should be equivalent', - 'ok 2 should be equivalent', - 'ok 3 should be equivalent', - 'ok 4 should be equivalent', - 'ok 5 should be equivalent', - 'not ok 6 plan != count', - ' ---', - ' operator: fail', - ' expected: 6', - ' actual: 5', - ' at: process. ($TAPE/index.js:$LINE:$COL)', - ' stack: |-', - ' Error: plan != count', - ' [... stack stripped ...]', - ' ...', - '', - '1..6', - '# tests 6', - '# pass 5', - '# fail 1', - '', - '' - ]); - }; - - var ps = spawn(process.execPath, [path.join(__dirname, '/exit/too_few.js')]); - ps.stdout.pipe(concat(tc)); - ps.on('exit', function (code) { - t.notEqual(code, 0); - }); + t.plan(2); + + var tc = function (rows) { + t.same(stripFullStack(rows.toString('utf8')), [ + 'TAP version 13', + '# array', + 'ok 1 should be equivalent', + 'ok 2 should be equivalent', + 'ok 3 should be equivalent', + 'ok 4 should be equivalent', + 'ok 5 should be equivalent', + 'not ok 6 plan != count', + ' ---', + ' operator: fail', + ' expected: 6', + ' actual: 5', + ' at: process. ($TAPE/index.js:$LINE:$COL)', + ' stack: |-', + ' Error: plan != count', + ' [... stack stripped ...]', + ' ...', + '', + '1..6', + '# tests 6', + '# pass 5', + '# fail 1', + '', + '' + ]); + }; + + var ps = spawn(process.execPath, [path.join(__dirname, '/exit/too_few.js')]); + ps.stdout.pipe(concat(tc)); + ps.on('exit', function (code) { + t.notEqual(code, 0); + }); }); tap.test('more planned in a second test', function (t) { - t.plan(2); - - var tc = function (rows) { - t.same(stripFullStack(rows.toString('utf8')), [ - 'TAP version 13', - '# first', - 'ok 1 should be truthy', - '# second', - 'ok 2 should be truthy', - 'not ok 3 plan != count', - ' ---', - ' operator: fail', - ' expected: 2', - ' actual: 1', - ' at: process. ($TAPE/index.js:$LINE:$COL)', - ' stack: |-', - ' Error: plan != count', - ' [... stack stripped ...]', - ' ...', - '', - '1..3', - '# tests 3', - '# pass 2', - '# fail 1', - '', - '' - ]); - }; - - var ps = spawn(process.execPath, [path.join(__dirname, '/exit/second.js')]); - ps.stdout.pipe(concat(tc)); - ps.on('exit', function (code) { - t.notEqual(code, 0); - }); + t.plan(2); + + var tc = function (rows) { + t.same(stripFullStack(rows.toString('utf8')), [ + 'TAP version 13', + '# first', + 'ok 1 should be truthy', + '# second', + 'ok 2 should be truthy', + 'not ok 3 plan != count', + ' ---', + ' operator: fail', + ' expected: 2', + ' actual: 1', + ' at: process. ($TAPE/index.js:$LINE:$COL)', + ' stack: |-', + ' Error: plan != count', + ' [... stack stripped ...]', + ' ...', + '', + '1..3', + '# tests 3', + '# pass 2', + '# fail 1', + '', + '' + ]); + }; + + var ps = spawn(process.execPath, [path.join(__dirname, '/exit/second.js')]); + ps.stdout.pipe(concat(tc)); + ps.on('exit', function (code) { + t.notEqual(code, 0); + }); }); tap.test('todo passing', function (t) { - t.plan(2); - - var tc = function (rows) { - t.same(stripFullStack(rows.toString('utf8')), [ - 'TAP version 13', - '# TODO todo pass', - 'ok 1 should be truthy # TODO', - '', - '1..1', - '# tests 1', - '# pass 1', - '', - '# ok', - '', - '' - ]); - }; - - var ps = spawn(process.execPath, [path.join(__dirname, '/exit/todo.js')]); - ps.stdout.pipe(concat(tc)); - ps.on('exit', function (code) { - t.equal(code, 0); - }); + t.plan(2); + + var tc = function (rows) { + t.same(stripFullStack(rows.toString('utf8')), [ + 'TAP version 13', + '# TODO todo pass', + 'ok 1 should be truthy # TODO', + '', + '1..1', + '# tests 1', + '# pass 1', + '', + '# ok', + '', + '' + ]); + }; + + var ps = spawn(process.execPath, [path.join(__dirname, '/exit/todo.js')]); + ps.stdout.pipe(concat(tc)); + ps.on('exit', function (code) { + t.equal(code, 0); + }); }); tap.test('todo failing', function (t) { - t.plan(2); - - var tc = function (rows) { - t.same(stripFullStack(rows.toString('utf8')), [ - 'TAP version 13', - '# TODO todo fail', - 'not ok 1 should be truthy # TODO', - ' ---', - ' operator: ok', - ' expected: true', - ' actual: false', - ' at: Test. ($TEST/exit/todo_fail.js:$LINE:$COL)', - ' ...', - '', - '1..1', - '# tests 1', - '# pass 1', - '', - '# ok', - '', - '' - ]); - }; - - var ps = spawn(process.execPath, [path.join(__dirname, '/exit/todo_fail.js')]); - ps.stdout.pipe(concat(tc)); - ps.on('exit', function (code) { - t.equal(code, 0); - }); + t.plan(2); + + var tc = function (rows) { + t.same(stripFullStack(rows.toString('utf8')), [ + 'TAP version 13', + '# TODO todo fail', + 'not ok 1 should be truthy # TODO', + ' ---', + ' operator: ok', + ' expected: true', + ' actual: false', + ' at: Test. ($TEST/exit/todo_fail.js:$LINE:$COL)', + ' ...', + '', + '1..1', + '# tests 1', + '# pass 1', + '', + '# ok', + '', + '' + ]); + }; + + var ps = spawn(process.execPath, [path.join(__dirname, '/exit/todo_fail.js')]); + ps.stdout.pipe(concat(tc)); + ps.on('exit', function (code) { + t.equal(code, 0); + }); }); tap.test('forgot to call t.end()', function (t) { - t.plan(2); - - var tc = function (rows) { - t.same(stripFullStack(rows.toString('utf8')), [ - 'TAP version 13', - '# first', - 'ok 1 should be truthy', - '# oops forgot end', - 'ok 2 should be truthy', - 'not ok 3 test exited without ending: oops forgot end', - ' ---', - ' operator: fail', - ' at: process. ($TAPE/index.js:$LINE:$COL)', - ' stack: |-', - ' Error: test exited without ending: oops forgot end', - ' [... stack stripped ...]', - ' ...', - '', - '1..3', - '# tests 3', - '# pass 2', - '# fail 1', - '', - '' - ]); - }; - - var ps = spawn(process.execPath, [path.join(__dirname, '/exit/missing_end.js')]); - ps.stdout.pipe(concat(tc)); - ps.on('exit', function (code) { - t.notEqual(code, 0); - }); + t.plan(2); + + var tc = function (rows) { + t.same(stripFullStack(rows.toString('utf8')), [ + 'TAP version 13', + '# first', + 'ok 1 should be truthy', + '# oops forgot end', + 'ok 2 should be truthy', + 'not ok 3 test exited without ending: oops forgot end', + ' ---', + ' operator: fail', + ' at: process. ($TAPE/index.js:$LINE:$COL)', + ' stack: |-', + ' Error: test exited without ending: oops forgot end', + ' [... stack stripped ...]', + ' ...', + '', + '1..3', + '# tests 3', + '# pass 2', + '# fail 1', + '', + '' + ]); + }; + + var ps = spawn(process.execPath, [path.join(__dirname, '/exit/missing_end.js')]); + ps.stdout.pipe(concat(tc)); + ps.on('exit', function (code) { + t.notEqual(code, 0); + }); }); diff --git a/test/exit/fail.js b/test/exit/fail.js index 930f51df..6c97ce1a 100644 --- a/test/exit/fail.js +++ b/test/exit/fail.js @@ -4,34 +4,34 @@ var test = require('../../'); var falafel = require('falafel'); test('array', function (t) { - t.plan(5); + t.plan(5); - var src = '(' + function () { - var xs = [1, 2, [3, 4]]; - var ys = [5, 6]; - g([xs, ys]); - } + ')()'; + var src = '(' + function () { + var xs = [1, 2, [3, 4]]; + var ys = [5, 6]; + g([xs, ys]); + } + ')()'; - var output = falafel(src, function (node) { - if (node.type === 'ArrayExpression') { - node.update('fn(' + node.source() + ')'); - } - }); + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); - var arrays = [ - [3, 4], - [1, 2, [3, 4]], - [5, 6], - [[1, 2, [3, 4]], [5, 6]] - ]; + var arrays = [ + [3, 4], + [1, 2, [3, 4]], + [5, 6], + [[1, 2, [3, 4]], [5, 6]] + ]; - Function(['fn', 'g'], output)( - function (xs) { - t.same(arrays.shift(), xs); - return xs; - }, - function (xs) { - t.same(xs, [[1, 2, [3, 4444]], [5, 6]]); - } - ); + Function(['fn', 'g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [[1, 2, [3, 4444]], [5, 6]]); + } + ); }); diff --git a/test/exit/missing_end.js b/test/exit/missing_end.js index 7616fec1..0009b724 100644 --- a/test/exit/missing_end.js +++ b/test/exit/missing_end.js @@ -3,10 +3,10 @@ var test = require('../../'); test('first', function (t) { - t.ok(true); - t.end(); + t.ok(true); + t.end(); }); test('oops forgot end', function (t) { - t.ok(true); + t.ok(true); }); diff --git a/test/exit/ok.js b/test/exit/ok.js index 7649d940..05a6bd18 100644 --- a/test/exit/ok.js +++ b/test/exit/ok.js @@ -4,35 +4,35 @@ var falafel = require('falafel'); var test = require('../../'); test('array', function (t) { - t.comment('hi'); - t.plan(5); + t.comment('hi'); + t.plan(5); - var src = '(' + function () { - var xs = [1, 2, [3, 4]]; - var ys = [5, 6]; - g([xs, ys]); - } + ')()'; + var src = '(' + function () { + var xs = [1, 2, [3, 4]]; + var ys = [5, 6]; + g([xs, ys]); + } + ')()'; - var output = falafel(src, function (node) { - if (node.type === 'ArrayExpression') { - node.update('fn(' + node.source() + ')'); - } - }); + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); - var arrays = [ - [3, 4], - [1, 2, [3, 4]], - [5, 6], - [[1, 2, [3, 4]], [5, 6]] - ]; + var arrays = [ + [3, 4], + [1, 2, [3, 4]], + [5, 6], + [[1, 2, [3, 4]], [5, 6]] + ]; - Function(['fn', 'g'], output)( - function (xs) { - t.same(arrays.shift(), xs); - return xs; - }, - function (xs) { - t.same(xs, [[1, 2, [3, 4]], [5, 6]]); - } - ); + Function(['fn', 'g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [[1, 2, [3, 4]], [5, 6]]); + } + ); }); diff --git a/test/exit/second.js b/test/exit/second.js index 79e632e2..e7ca2cf5 100644 --- a/test/exit/second.js +++ b/test/exit/second.js @@ -3,11 +3,11 @@ var test = require('../../'); test('first', function (t) { - t.plan(1); - t.ok(true); + t.plan(1); + t.ok(true); }); test('second', function (t) { - t.plan(2); - t.ok(true); + t.plan(2); + t.ok(true); }); diff --git a/test/exit/todo.js b/test/exit/todo.js index bf0de1a8..b6863c59 100644 --- a/test/exit/todo.js +++ b/test/exit/todo.js @@ -3,6 +3,6 @@ var test = require('../../'); test('todo pass', { todo: true }, function (t) { - t.plan(1); - t.ok(true); + t.plan(1); + t.ok(true); }); diff --git a/test/exit/todo_fail.js b/test/exit/todo_fail.js index 06ec32f1..6e8dea93 100644 --- a/test/exit/todo_fail.js +++ b/test/exit/todo_fail.js @@ -3,6 +3,6 @@ var test = require('../../'); test('todo fail', { todo: true }, function (t) { - t.plan(1); - t.ok(false); + t.plan(1); + t.ok(false); }); diff --git a/test/exit/too_few.js b/test/exit/too_few.js index 33bc0855..cf88c1cc 100644 --- a/test/exit/too_few.js +++ b/test/exit/too_few.js @@ -4,34 +4,34 @@ var falafel = require('falafel'); var test = require('../../'); test('array', function (t) { - t.plan(6); + t.plan(6); - var src = '(' + function () { - var xs = [1, 2, [3, 4]]; - var ys = [5, 6]; - g([xs, ys]); - } + ')()'; + var src = '(' + function () { + var xs = [1, 2, [3, 4]]; + var ys = [5, 6]; + g([xs, ys]); + } + ')()'; - var output = falafel(src, function (node) { - if (node.type === 'ArrayExpression') { - node.update('fn(' + node.source() + ')'); - } - }); + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); - var arrays = [ - [3, 4], - [1, 2, [3, 4]], - [5, 6], - [[1, 2, [3, 4]], [5, 6]] - ]; + var arrays = [ + [3, 4], + [1, 2, [3, 4]], + [5, 6], + [[1, 2, [3, 4]], [5, 6]] + ]; - Function(['fn', 'g'], output)( - function (xs) { - t.same(arrays.shift(), xs); - return xs; - }, - function (xs) { - t.same(xs, [[1, 2, [3, 4]], [5, 6]]); - } - ); + Function(['fn', 'g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [[1, 2, [3, 4]], [5, 6]]); + } + ); }); diff --git a/test/exposed-harness.js b/test/exposed-harness.js index d153eda7..cb8b6019 100644 --- a/test/exposed-harness.js +++ b/test/exposed-harness.js @@ -5,10 +5,10 @@ var tap = require('tap'); tap.test('main harness object is exposed', function (assert) { - assert.equal(typeof tape.getHarness, 'function', 'tape.getHarness is a function'); + assert.equal(typeof tape.getHarness, 'function', 'tape.getHarness is a function'); - assert.equal(tape.getHarness()._results.pass, 0); + assert.equal(tape.getHarness()._results.pass, 0); - assert.end(); + assert.end(); }); diff --git a/test/fail.js b/test/fail.js index 7a1f7285..6835e7bd 100644 --- a/test/fail.js +++ b/test/fail.js @@ -8,73 +8,73 @@ var concat = require('concat-stream'); var stripFullStack = require('./common').stripFullStack; tap.test('array test', function (tt) { - tt.plan(1); + tt.plan(1); - var test = tape.createHarness({ exit: false }); - var tc = function (rows) { - tt.same(stripFullStack(rows.toString('utf8')), [ - 'TAP version 13', - '# array', - 'ok 1 should be equivalent', - 'ok 2 should be equivalent', - 'ok 3 should be equivalent', - 'ok 4 should be equivalent', - 'not ok 5 should be equivalent', - ' ---', - ' operator: deepEqual', - ' expected: [ [ 1, 2, [ 3, 4444 ] ], [ 5, 6 ] ]', - ' actual: [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]', - ' at: ($TEST/fail.js:$LINE:$COL)', - ' stack: |-', - ' Error: should be equivalent', - ' [... stack stripped ...]', - ' at $TEST/fail.js:$LINE:$COL', - ' at eval (eval at ($TEST/fail.js:$LINE:$COL))', - ' at eval (eval at ($TEST/fail.js:$LINE:$COL))', - ' at Test. ($TEST/fail.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - '', - '1..5', - '# tests 5', - '# pass 4', - '# fail 1', - '' - ]); - }; + var test = tape.createHarness({ exit: false }); + var tc = function (rows) { + tt.same(stripFullStack(rows.toString('utf8')), [ + 'TAP version 13', + '# array', + 'ok 1 should be equivalent', + 'ok 2 should be equivalent', + 'ok 3 should be equivalent', + 'ok 4 should be equivalent', + 'not ok 5 should be equivalent', + ' ---', + ' operator: deepEqual', + ' expected: [ [ 1, 2, [ 3, 4444 ] ], [ 5, 6 ] ]', + ' actual: [ [ 1, 2, [ 3, 4 ] ], [ 5, 6 ] ]', + ' at: ($TEST/fail.js:$LINE:$COL)', + ' stack: |-', + ' Error: should be equivalent', + ' [... stack stripped ...]', + ' at $TEST/fail.js:$LINE:$COL', + ' at eval (eval at ($TEST/fail.js:$LINE:$COL))', + ' at eval (eval at ($TEST/fail.js:$LINE:$COL))', + ' at Test. ($TEST/fail.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + '', + '1..5', + '# tests 5', + '# pass 4', + '# fail 1', + '' + ]); + }; - test.createStream().pipe(concat(tc)); + test.createStream().pipe(concat(tc)); - test('array', function (t) { - t.plan(5); + test('array', function (t) { + t.plan(5); - var src = '(' + function () { - var xs = [1, 2, [3, 4]]; - var ys = [5, 6]; - g([xs, ys]); - } + ')()'; + var src = '(' + function () { + var xs = [1, 2, [3, 4]]; + var ys = [5, 6]; + g([xs, ys]); + } + ')()'; - var output = falafel(src, function (node) { - if (node.type === 'ArrayExpression') { - node.update('fn(' + node.source() + ')'); - } - }); + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); - var arrays = [ - [3, 4], - [1, 2, [3, 4]], - [5, 6], - [[1, 2, [3, 4]], [5, 6]] - ]; + var arrays = [ + [3, 4], + [1, 2, [3, 4]], + [5, 6], + [[1, 2, [3, 4]], [5, 6]] + ]; - Function(['fn', 'g'], output)( - function (xs) { - t.same(arrays.shift(), xs); - return xs; - }, - function (xs) { - t.same(xs, [[1, 2, [3, 4444]], [5, 6]]); - } - ); - }); + Function(['fn', 'g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [[1, 2, [3, 4444]], [5, 6]]); + } + ); + }); }); diff --git a/test/has spaces.js b/test/has spaces.js index 990c9d88..8aa149b7 100644 --- a/test/has spaces.js +++ b/test/has spaces.js @@ -7,36 +7,36 @@ var concat = require('concat-stream'); var stripFullStack = require('./common').stripFullStack; tap.test('array test', function (tt) { - tt.plan(1); + tt.plan(1); - var test = tape.createHarness({ exit: false }); - var tc = function (rows) { - tt.same(stripFullStack(rows.toString('utf8')), [ - 'TAP version 13', - '# fail', - 'not ok 1 this should fail', - ' ---', - ' operator: fail', - ' at: Test. ($TEST/has spaces.js:$LINE:$COL)', - ' stack: |-', - ' Error: this should fail', - ' [... stack stripped ...]', - ' at Test. ($TEST/has spaces.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - '', - '1..1', - '# tests 1', - '# pass 0', - '# fail 1', - '' - ]); - }; + var test = tape.createHarness({ exit: false }); + var tc = function (rows) { + tt.same(stripFullStack(rows.toString('utf8')), [ + 'TAP version 13', + '# fail', + 'not ok 1 this should fail', + ' ---', + ' operator: fail', + ' at: Test. ($TEST/has spaces.js:$LINE:$COL)', + ' stack: |-', + ' Error: this should fail', + ' [... stack stripped ...]', + ' at Test. ($TEST/has spaces.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + '', + '1..1', + '# tests 1', + '# pass 0', + '# fail 1', + '' + ]); + }; - test.createStream().pipe(concat(tc)); + test.createStream().pipe(concat(tc)); - test('fail', function (t) { - t.fail('this should fail'); - t.end(); - }); + test('fail', function (t) { + t.fail('this should fail'); + t.end(); + }); }); diff --git a/test/ignore/fake_node_modules/stub1.js b/test/ignore/fake_node_modules/stub1.js index 6ef0b71c..d8d58e15 100644 --- a/test/ignore/fake_node_modules/stub1.js +++ b/test/ignore/fake_node_modules/stub1.js @@ -3,6 +3,6 @@ var tape = require('../../../'); tape.test(function (t) { - t.plan(1); - t.fail('Should not print'); + t.plan(1); + t.fail('Should not print'); }); diff --git a/test/ignore/fake_node_modules/stub2.js b/test/ignore/fake_node_modules/stub2.js index 27bebd87..213ee99e 100644 --- a/test/ignore/fake_node_modules/stub2.js +++ b/test/ignore/fake_node_modules/stub2.js @@ -3,6 +3,6 @@ var tape = require('../../../'); tape.test(function (t) { - t.fail('Should not print'); - t.end(); + t.fail('Should not print'); + t.end(); }); diff --git a/test/ignore/test.js b/test/ignore/test.js index f2d6f572..52777336 100644 --- a/test/ignore/test.js +++ b/test/ignore/test.js @@ -3,6 +3,6 @@ var tape = require('../../'); tape.test(function (t) { - t.plan(1); - t.ok('Okay'); + t.plan(1); + t.ok('Okay'); }); diff --git a/test/ignore/test/stub1.js b/test/ignore/test/stub1.js index e91244ee..0ea00c46 100644 --- a/test/ignore/test/stub1.js +++ b/test/ignore/test/stub1.js @@ -3,6 +3,6 @@ var tape = require('../../../'); tape.test(function (t) { - t.plan(1); - t.pass('test/stub1'); + t.plan(1); + t.pass('test/stub1'); }); diff --git a/test/ignore/test/stub2.js b/test/ignore/test/stub2.js index f4661b88..7f061890 100644 --- a/test/ignore/test/stub2.js +++ b/test/ignore/test/stub2.js @@ -3,6 +3,6 @@ var tape = require('../../../'); tape.test(function (t) { - t.pass('test/stub2'); - t.end(); + t.pass('test/stub2'); + t.end(); }); diff --git a/test/ignore/test/sub/sub.stub1.js b/test/ignore/test/sub/sub.stub1.js index 0f39cfee..96a23cde 100644 --- a/test/ignore/test/sub/sub.stub1.js +++ b/test/ignore/test/sub/sub.stub1.js @@ -3,6 +3,6 @@ var tape = require('../../../../'); tape.test(function (t) { - t.plan(1); - t.pass('test/sub/stub1'); + t.plan(1); + t.pass('test/sub/stub1'); }); diff --git a/test/ignore/test/sub/sub.stub2.js b/test/ignore/test/sub/sub.stub2.js index bec910d7..daa2c84e 100644 --- a/test/ignore/test/sub/sub.stub2.js +++ b/test/ignore/test/sub/sub.stub2.js @@ -3,6 +3,6 @@ var tape = require('../../../../'); tape.test(function (t) { - t.pass('test/sub/stub2'); - t.end(); + t.pass('test/sub/stub2'); + t.end(); }); diff --git a/test/ignore/test2.js b/test/ignore/test2.js index a2ceecc0..1364e64d 100644 --- a/test/ignore/test2.js +++ b/test/ignore/test2.js @@ -3,6 +3,6 @@ var tape = require('../../'); tape.test(function (t) { - t.pass('Should print'); - t.end(); + t.pass('Should print'); + t.end(); }); diff --git a/test/ignore_from_gitignore.js b/test/ignore_from_gitignore.js index 8260c2ec..3e46cdc5 100644 --- a/test/ignore_from_gitignore.js +++ b/test/ignore_from_gitignore.js @@ -10,113 +10,113 @@ var stripFullStack = require('./common').stripFullStack; var tapeBin = path.join(process.cwd(), 'bin/tape'); tap.test('Should pass with ignoring', { skip: process.platform === 'win32' }, function (tt) { - tt.plan(2); + tt.plan(2); - var tc = function (rows) { - tt.same(stripFullStack(rows.toString('utf8')), [ - 'TAP version 13', - '# (anonymous)', - 'ok 1 should be truthy', - '# (anonymous)', - 'ok 2 test/stub1', - '# (anonymous)', - 'ok 3 test/stub2', - '# (anonymous)', - 'ok 4 test/sub/stub1', - '# (anonymous)', - 'ok 5 test/sub/stub2', - '# (anonymous)', - 'ok 6 Should print', - '', - '1..6', - '# tests 6', - '# pass 6', - '', - '# ok', - '', - '' - ]); - }; + var tc = function (rows) { + tt.same(stripFullStack(rows.toString('utf8')), [ + 'TAP version 13', + '# (anonymous)', + 'ok 1 should be truthy', + '# (anonymous)', + 'ok 2 test/stub1', + '# (anonymous)', + 'ok 3 test/stub2', + '# (anonymous)', + 'ok 4 test/sub/stub1', + '# (anonymous)', + 'ok 5 test/sub/stub2', + '# (anonymous)', + 'ok 6 Should print', + '', + '1..6', + '# tests 6', + '# pass 6', + '', + '# ok', + '', + '' + ]); + }; - var ps = spawn(tapeBin, ['**/*.js', '-i', '.ignore'], { cwd: path.join(__dirname, 'ignore') }); - ps.stdout.pipe(concat(tc)); - ps.on('exit', function (code) { - tt.equal(code, 0); // code 0 - }); + var ps = spawn(tapeBin, ['**/*.js', '-i', '.ignore'], { cwd: path.join(__dirname, 'ignore') }); + ps.stdout.pipe(concat(tc)); + ps.on('exit', function (code) { + tt.equal(code, 0); // code 0 + }); }); tap.test('Should pass', { skip: process.platform === 'win32' }, function (tt) { - tt.plan(2); + tt.plan(2); - var tc = function (rows) { - tt.same(stripFullStack(rows.toString('utf8')), [ - 'TAP version 13', - '# (anonymous)', - 'not ok 1 Should not print', - ' ---', - ' operator: fail', - ' at: Test. ($TEST/ignore/fake_node_modules/stub1.js:$LINE:$COL)', - ' stack: |-', - ' Error: Should not print', - ' [... stack stripped ...]', - ' at Test. ($TEST/ignore/fake_node_modules/stub1.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - '# (anonymous)', - 'not ok 2 Should not print', - ' ---', - ' operator: fail', - ' at: Test. ($TEST/ignore/fake_node_modules/stub2.js:$LINE:$COL)', - ' stack: |-', - ' Error: Should not print', - ' [... stack stripped ...]', - ' at Test. ($TEST/ignore/fake_node_modules/stub2.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - '# (anonymous)', - 'ok 3 should be truthy', - '# (anonymous)', - 'ok 4 test/stub1', - '# (anonymous)', - 'ok 5 test/stub2', - '# (anonymous)', - 'ok 6 test/sub/stub1', - '# (anonymous)', - 'ok 7 test/sub/stub2', - '# (anonymous)', - 'ok 8 Should print', - '', - '1..8', - '# tests 8', - '# pass 6', - '# fail 2', - '', - '' - ]); - }; + var tc = function (rows) { + tt.same(stripFullStack(rows.toString('utf8')), [ + 'TAP version 13', + '# (anonymous)', + 'not ok 1 Should not print', + ' ---', + ' operator: fail', + ' at: Test. ($TEST/ignore/fake_node_modules/stub1.js:$LINE:$COL)', + ' stack: |-', + ' Error: Should not print', + ' [... stack stripped ...]', + ' at Test. ($TEST/ignore/fake_node_modules/stub1.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + '# (anonymous)', + 'not ok 2 Should not print', + ' ---', + ' operator: fail', + ' at: Test. ($TEST/ignore/fake_node_modules/stub2.js:$LINE:$COL)', + ' stack: |-', + ' Error: Should not print', + ' [... stack stripped ...]', + ' at Test. ($TEST/ignore/fake_node_modules/stub2.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + '# (anonymous)', + 'ok 3 should be truthy', + '# (anonymous)', + 'ok 4 test/stub1', + '# (anonymous)', + 'ok 5 test/stub2', + '# (anonymous)', + 'ok 6 test/sub/stub1', + '# (anonymous)', + 'ok 7 test/sub/stub2', + '# (anonymous)', + 'ok 8 Should print', + '', + '1..8', + '# tests 8', + '# pass 6', + '# fail 2', + '', + '' + ]); + }; - var ps = spawn(tapeBin, ['**/*.js'], { cwd: path.join(__dirname, 'ignore') }); - ps.stdout.pipe(concat(tc)); - ps.on('exit', function (code) { - tt.equal(code, 1); - }); + var ps = spawn(tapeBin, ['**/*.js'], { cwd: path.join(__dirname, 'ignore') }); + ps.stdout.pipe(concat(tc)); + ps.on('exit', function (code) { + tt.equal(code, 1); + }); }); tap.test('Should fail when ignore file does not exist', { skip: process.platform === 'win32' }, function (tt) { - tt.plan(3); + tt.plan(3); - var testStdout = function (rows) { - tt.same(rows.toString('utf8'), ''); - }; + var testStdout = function (rows) { + tt.same(rows.toString('utf8'), ''); + }; - var testStderr = function (rows) { - tt.ok((/^ENOENT[:,] no such file or directory,? (?:open )?'\$TEST\/ignore\/.gitignore'\n$/m).test(stripFullStack(rows.toString('utf8')).join('\n'))); - }; + var testStderr = function (rows) { + tt.ok((/^ENOENT[:,] no such file or directory,? (?:open )?'\$TEST\/ignore\/.gitignore'\n$/m).test(stripFullStack(rows.toString('utf8')).join('\n'))); + }; - var ps = spawn(tapeBin, ['**/*.js', '-i'], { cwd: path.join(__dirname, 'ignore') }); - ps.stdout.pipe(concat(testStdout)); - ps.stderr.pipe(concat(testStderr)); - ps.on('exit', function (code) { - tt.equal(code, 2); - }); + var ps = spawn(tapeBin, ['**/*.js', '-i'], { cwd: path.join(__dirname, 'ignore') }); + ps.stdout.pipe(concat(testStdout)); + ps.stderr.pipe(concat(testStderr)); + ps.on('exit', function (code) { + tt.equal(code, 2); + }); }); diff --git a/test/many.js b/test/many.js index 6e5368a3..99b8ff06 100644 --- a/test/many.js +++ b/test/many.js @@ -3,8 +3,8 @@ var test = require('../'); test('many tests', function (t) { - t.plan(100); - for (var i = 0; i < 100; i++) { - setTimeout(function () { t.pass(); }, Math.random() * 50); - } + t.plan(100); + for (var i = 0; i < 100; i++) { + setTimeout(function () { t.pass(); }, Math.random() * 50); + } }); diff --git a/test/match.js b/test/match.js index c7c6a097..5fd1879d 100644 --- a/test/match.js +++ b/test/match.js @@ -7,252 +7,252 @@ var concat = require('concat-stream'); var stripFullStack = require('./common').stripFullStack; tap.test('match', function (tt) { - tt.plan(1); + tt.plan(1); - var test = tape.createHarness({ exit: false }); - var tc = function (rows) { - tt.same(stripFullStack(rows.toString('utf8')), [ - 'TAP version 13', - '# match', - 'not ok 1 The "regexp" argument must be an instance of RegExp. Received type string (\'string\')', - ' ---', - ' operator: match', - ' expected: \'[object RegExp]\'', - ' actual: \'[object String]\'', - ' at: Test. ($TEST/match.js:$LINE:$COL)', - ' stack: |-', - ' Error: The "regexp" argument must be an instance of RegExp. Received type string (\'string\')', - ' [... stack stripped ...]', - ' at Test. ($TEST/match.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 2 regex arg must not be a string', - ' ---', - ' operator: match', - ' expected: \'[object RegExp]\'', - ' actual: \'[object String]\'', - ' at: Test. ($TEST/match.js:$LINE:$COL)', - ' stack: |-', - ' Error: regex arg must not be a string', - ' [... stack stripped ...]', - ' at Test. ($TEST/match.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 3 The "string" argument must be of type string. Received type object ({ abc: 123 })', - ' ---', - ' operator: match', - ' expected: \'string\'', - ' actual: \'object\'', - ' at: Test. ($TEST/match.js:$LINE:$COL)', - ' stack: |-', - ' Error: The "string" argument must be of type string. Received type object ({ abc: 123 })', - ' [... stack stripped ...]', - ' at Test. ($TEST/match.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 4 string arg must not be an object', - ' ---', - ' operator: match', - ' expected: \'string\'', - ' actual: \'object\'', - ' at: Test. ($TEST/match.js:$LINE:$COL)', - ' stack: |-', - ' Error: string arg must not be an object', - ' [... stack stripped ...]', - ' at Test. ($TEST/match.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 5 The input did not match the regular expression /abc/. Input: \'string\'', - ' ---', - ' operator: match', - ' expected: /abc/', - ' actual: \'string\'', - ' at: Test. ($TEST/match.js:$LINE:$COL)', - ' stack: |-', - ' Error: The input did not match the regular expression /abc/. Input: \'string\'', - ' [... stack stripped ...]', - ' at Test. ($TEST/match.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 6 "string" does not match /abc/', - ' ---', - ' operator: match', - ' expected: /abc/', - ' actual: \'string\'', - ' at: Test. ($TEST/match.js:$LINE:$COL)', - ' stack: |-', - ' Error: "string" does not match /abc/', - ' [... stack stripped ...]', - ' at Test. ($TEST/match.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'ok 7 The input matched the regular expression /pass$/. Input: \'I will pass\'', - 'ok 8 "I will pass" matches /pass$/', - '', - '1..8', - '# tests 8', - '# pass 2', - '# fail 6', - '' - ]); - }; + var test = tape.createHarness({ exit: false }); + var tc = function (rows) { + tt.same(stripFullStack(rows.toString('utf8')), [ + 'TAP version 13', + '# match', + 'not ok 1 The "regexp" argument must be an instance of RegExp. Received type string (\'string\')', + ' ---', + ' operator: match', + ' expected: \'[object RegExp]\'', + ' actual: \'[object String]\'', + ' at: Test. ($TEST/match.js:$LINE:$COL)', + ' stack: |-', + ' Error: The "regexp" argument must be an instance of RegExp. Received type string (\'string\')', + ' [... stack stripped ...]', + ' at Test. ($TEST/match.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 2 regex arg must not be a string', + ' ---', + ' operator: match', + ' expected: \'[object RegExp]\'', + ' actual: \'[object String]\'', + ' at: Test. ($TEST/match.js:$LINE:$COL)', + ' stack: |-', + ' Error: regex arg must not be a string', + ' [... stack stripped ...]', + ' at Test. ($TEST/match.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 3 The "string" argument must be of type string. Received type object ({ abc: 123 })', + ' ---', + ' operator: match', + ' expected: \'string\'', + ' actual: \'object\'', + ' at: Test. ($TEST/match.js:$LINE:$COL)', + ' stack: |-', + ' Error: The "string" argument must be of type string. Received type object ({ abc: 123 })', + ' [... stack stripped ...]', + ' at Test. ($TEST/match.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 4 string arg must not be an object', + ' ---', + ' operator: match', + ' expected: \'string\'', + ' actual: \'object\'', + ' at: Test. ($TEST/match.js:$LINE:$COL)', + ' stack: |-', + ' Error: string arg must not be an object', + ' [... stack stripped ...]', + ' at Test. ($TEST/match.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 5 The input did not match the regular expression /abc/. Input: \'string\'', + ' ---', + ' operator: match', + ' expected: /abc/', + ' actual: \'string\'', + ' at: Test. ($TEST/match.js:$LINE:$COL)', + ' stack: |-', + ' Error: The input did not match the regular expression /abc/. Input: \'string\'', + ' [... stack stripped ...]', + ' at Test. ($TEST/match.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 6 "string" does not match /abc/', + ' ---', + ' operator: match', + ' expected: /abc/', + ' actual: \'string\'', + ' at: Test. ($TEST/match.js:$LINE:$COL)', + ' stack: |-', + ' Error: "string" does not match /abc/', + ' [... stack stripped ...]', + ' at Test. ($TEST/match.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'ok 7 The input matched the regular expression /pass$/. Input: \'I will pass\'', + 'ok 8 "I will pass" matches /pass$/', + '', + '1..8', + '# tests 8', + '# pass 2', + '# fail 6', + '' + ]); + }; - test.createStream().pipe(concat(tc)); + test.createStream().pipe(concat(tc)); - test('match', function (t) { - t.plan(8); + test('match', function (t) { + t.plan(8); - t.match(/abc/, 'string'); - t.match(/abc/, 'string', 'regex arg must not be a string'); + t.match(/abc/, 'string'); + t.match(/abc/, 'string', 'regex arg must not be a string'); - t.match({ abc: 123 }, /abc/); - t.match({ abc: 123 }, /abc/, 'string arg must not be an object'); + t.match({ abc: 123 }, /abc/); + t.match({ abc: 123 }, /abc/, 'string arg must not be an object'); - t.match('string', /abc/); - t.match('string', /abc/, '"string" does not match /abc/'); + t.match('string', /abc/); + t.match('string', /abc/, '"string" does not match /abc/'); - t.match('I will pass', /pass$/); - t.match('I will pass', /pass$/, '"I will pass" matches /pass$/'); + t.match('I will pass', /pass$/); + t.match('I will pass', /pass$/, '"I will pass" matches /pass$/'); - t.end(); - }); + t.end(); + }); }); tap.test('doesNotMatch', function (tt) { - tt.plan(1); + tt.plan(1); - var test = tape.createHarness({ exit: false }); - var tc = function (rows) { - tt.same(stripFullStack(rows.toString('utf8')), [ - 'TAP version 13', - '# doesNotMatch', - 'not ok 1 The "regexp" argument must be an instance of RegExp. Received type string (\'string\')', - ' ---', - ' operator: doesNotMatch', - ' expected: \'[object RegExp]\'', - ' actual: \'[object String]\'', - ' at: Test. ($TEST/match.js:$LINE:$COL)', - ' stack: |-', - ' Error: The "regexp" argument must be an instance of RegExp. Received type string (\'string\')', - ' [... stack stripped ...]', - ' at Test. ($TEST/match.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 2 regex arg must not be a string', - ' ---', - ' operator: doesNotMatch', - ' expected: \'[object RegExp]\'', - ' actual: \'[object String]\'', - ' at: Test. ($TEST/match.js:$LINE:$COL)', - ' stack: |-', - ' Error: regex arg must not be a string', - ' [... stack stripped ...]', - ' at Test. ($TEST/match.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 3 The "string" argument must be of type string. Received type object ({ abc: 123 })', - ' ---', - ' operator: doesNotMatch', - ' expected: \'string\'', - ' actual: \'object\'', - ' at: Test. ($TEST/match.js:$LINE:$COL)', - ' stack: |-', - ' Error: The "string" argument must be of type string. Received type object ({ abc: 123 })', - ' [... stack stripped ...]', - ' at Test. ($TEST/match.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 4 string arg must not be an object', - ' ---', - ' operator: doesNotMatch', - ' expected: \'string\'', - ' actual: \'object\'', - ' at: Test. ($TEST/match.js:$LINE:$COL)', - ' stack: |-', - ' Error: string arg must not be an object', - ' [... stack stripped ...]', - ' at Test. ($TEST/match.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 5 The input was expected to not match the regular expression /string/. Input: \'string\'', - ' ---', - ' operator: doesNotMatch', - ' expected: /string/', - ' actual: \'string\'', - ' at: Test. ($TEST/match.js:$LINE:$COL)', - ' stack: |-', - ' Error: The input was expected to not match the regular expression /string/. Input: \'string\'', - ' [... stack stripped ...]', - ' at Test. ($TEST/match.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 6 "string" should not match /string/', - ' ---', - ' operator: doesNotMatch', - ' expected: /string/', - ' actual: \'string\'', - ' at: Test. ($TEST/match.js:$LINE:$COL)', - ' stack: |-', - ' Error: "string" should not match /string/', - ' [... stack stripped ...]', - ' at Test. ($TEST/match.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 7 The input was expected to not match the regular expression /pass$/. Input: \'I will pass\'', - ' ---', - ' operator: doesNotMatch', - ' expected: /pass$/', - ' actual: \'I will pass\'', - ' at: Test. ($TEST/match.js:$LINE:$COL)', - ' stack: |-', - ' Error: The input was expected to not match the regular expression /pass$/. Input: \'I will pass\'', - ' [... stack stripped ...]', - ' at Test. ($TEST/match.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 8 "I will pass" should not match /pass$/', - ' ---', - ' operator: doesNotMatch', - ' expected: /pass$/', - ' actual: \'I will pass\'', - ' at: Test. ($TEST/match.js:$LINE:$COL)', - ' stack: |-', - ' Error: "I will pass" should not match /pass$/', - ' [... stack stripped ...]', - ' at Test. ($TEST/match.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'ok 9 The input did not match the regular expression /pass$/. Input: \'I will fail\'', - 'ok 10 "I will fail" does not match /pass$/', - '', - '1..10', - '# tests 10', - '# pass 2', - '# fail 8', - '' - ]); - }; + var test = tape.createHarness({ exit: false }); + var tc = function (rows) { + tt.same(stripFullStack(rows.toString('utf8')), [ + 'TAP version 13', + '# doesNotMatch', + 'not ok 1 The "regexp" argument must be an instance of RegExp. Received type string (\'string\')', + ' ---', + ' operator: doesNotMatch', + ' expected: \'[object RegExp]\'', + ' actual: \'[object String]\'', + ' at: Test. ($TEST/match.js:$LINE:$COL)', + ' stack: |-', + ' Error: The "regexp" argument must be an instance of RegExp. Received type string (\'string\')', + ' [... stack stripped ...]', + ' at Test. ($TEST/match.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 2 regex arg must not be a string', + ' ---', + ' operator: doesNotMatch', + ' expected: \'[object RegExp]\'', + ' actual: \'[object String]\'', + ' at: Test. ($TEST/match.js:$LINE:$COL)', + ' stack: |-', + ' Error: regex arg must not be a string', + ' [... stack stripped ...]', + ' at Test. ($TEST/match.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 3 The "string" argument must be of type string. Received type object ({ abc: 123 })', + ' ---', + ' operator: doesNotMatch', + ' expected: \'string\'', + ' actual: \'object\'', + ' at: Test. ($TEST/match.js:$LINE:$COL)', + ' stack: |-', + ' Error: The "string" argument must be of type string. Received type object ({ abc: 123 })', + ' [... stack stripped ...]', + ' at Test. ($TEST/match.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 4 string arg must not be an object', + ' ---', + ' operator: doesNotMatch', + ' expected: \'string\'', + ' actual: \'object\'', + ' at: Test. ($TEST/match.js:$LINE:$COL)', + ' stack: |-', + ' Error: string arg must not be an object', + ' [... stack stripped ...]', + ' at Test. ($TEST/match.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 5 The input was expected to not match the regular expression /string/. Input: \'string\'', + ' ---', + ' operator: doesNotMatch', + ' expected: /string/', + ' actual: \'string\'', + ' at: Test. ($TEST/match.js:$LINE:$COL)', + ' stack: |-', + ' Error: The input was expected to not match the regular expression /string/. Input: \'string\'', + ' [... stack stripped ...]', + ' at Test. ($TEST/match.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 6 "string" should not match /string/', + ' ---', + ' operator: doesNotMatch', + ' expected: /string/', + ' actual: \'string\'', + ' at: Test. ($TEST/match.js:$LINE:$COL)', + ' stack: |-', + ' Error: "string" should not match /string/', + ' [... stack stripped ...]', + ' at Test. ($TEST/match.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 7 The input was expected to not match the regular expression /pass$/. Input: \'I will pass\'', + ' ---', + ' operator: doesNotMatch', + ' expected: /pass$/', + ' actual: \'I will pass\'', + ' at: Test. ($TEST/match.js:$LINE:$COL)', + ' stack: |-', + ' Error: The input was expected to not match the regular expression /pass$/. Input: \'I will pass\'', + ' [... stack stripped ...]', + ' at Test. ($TEST/match.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 8 "I will pass" should not match /pass$/', + ' ---', + ' operator: doesNotMatch', + ' expected: /pass$/', + ' actual: \'I will pass\'', + ' at: Test. ($TEST/match.js:$LINE:$COL)', + ' stack: |-', + ' Error: "I will pass" should not match /pass$/', + ' [... stack stripped ...]', + ' at Test. ($TEST/match.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'ok 9 The input did not match the regular expression /pass$/. Input: \'I will fail\'', + 'ok 10 "I will fail" does not match /pass$/', + '', + '1..10', + '# tests 10', + '# pass 2', + '# fail 8', + '' + ]); + }; - test.createStream().pipe(concat(tc)); + test.createStream().pipe(concat(tc)); - test('doesNotMatch', function (t) { - t.plan(10); + test('doesNotMatch', function (t) { + t.plan(10); - t.doesNotMatch(/abc/, 'string'); - t.doesNotMatch(/abc/, 'string', 'regex arg must not be a string'); + t.doesNotMatch(/abc/, 'string'); + t.doesNotMatch(/abc/, 'string', 'regex arg must not be a string'); - t.doesNotMatch({ abc: 123 }, /abc/); - t.doesNotMatch({ abc: 123 }, /abc/, 'string arg must not be an object'); + t.doesNotMatch({ abc: 123 }, /abc/); + t.doesNotMatch({ abc: 123 }, /abc/, 'string arg must not be an object'); - t.doesNotMatch('string', /string/); - t.doesNotMatch('string', /string/, '"string" should not match /string/'); + t.doesNotMatch('string', /string/); + t.doesNotMatch('string', /string/, '"string" should not match /string/'); - t.doesNotMatch('I will pass', /pass$/); - t.doesNotMatch('I will pass', /pass$/, '"I will pass" should not match /pass$/'); + t.doesNotMatch('I will pass', /pass$/); + t.doesNotMatch('I will pass', /pass$/, '"I will pass" should not match /pass$/'); - t.doesNotMatch('I will fail', /pass$/); - t.doesNotMatch('I will fail', /pass$/, '"I will fail" does not match /pass$/'); + t.doesNotMatch('I will fail', /pass$/); + t.doesNotMatch('I will fail', /pass$/, '"I will fail" does not match /pass$/'); - t.end(); - }); + t.end(); + }); }); diff --git a/test/max_listeners.js b/test/max_listeners.js index 286a2b15..34335d0c 100644 --- a/test/max_listeners.js +++ b/test/max_listeners.js @@ -8,5 +8,5 @@ var ps = spawn(process.execPath, [path.join(__dirname, 'max_listeners', 'source. ps.stdout.pipe(process.stdout, { end: false }); ps.stderr.on('data', function (buf) { - console.log('not ok ' + buf); + console.log('not ok ' + buf); }); diff --git a/test/max_listeners/source.js b/test/max_listeners/source.js index 137f8a1c..5443182d 100644 --- a/test/max_listeners/source.js +++ b/test/max_listeners/source.js @@ -3,8 +3,8 @@ var test = require('../../'); for (var i = 0; i < 11; i++) { - test(function (t) { - t.ok(true, 'true is truthy'); - t.end(); - }); + test(function (t) { + t.ok(true, 'true is truthy'); + t.end(); + }); } diff --git a/test/messages/defaults.js b/test/messages/defaults.js index e9672147..6e01fe25 100644 --- a/test/messages/defaults.js +++ b/test/messages/defaults.js @@ -3,23 +3,23 @@ var test = require('../../'); test('default messages', function (t) { - t.plan(12); + t.plan(12); - t.ok(true); - t.notOk(false); + t.ok(true); + t.notOk(false); - t.equal(true, true); - t.notEqual(true, false); + t.equal(true, true); + t.notEqual(true, false); - t.looseEqual(true, true); - t.notLooseEqual(true, false); + t.looseEqual(true, true); + t.notLooseEqual(true, false); - t.strictEqual(true, true); - t.notStrictEqual(true, false); + t.strictEqual(true, true); + t.notStrictEqual(true, false); - t.deepEqual(true, true); - t.notDeepEqual(true, true); + t.deepEqual(true, true); + t.notDeepEqual(true, true); - t.deepLooseEqual(true, true); - t.notDeepLooseEqual(true, false); + t.deepLooseEqual(true, true); + t.notDeepLooseEqual(true, false); }); diff --git a/test/nested-async-plan-noend.js b/test/nested-async-plan-noend.js index a086d8ed..a0339d38 100644 --- a/test/nested-async-plan-noend.js +++ b/test/nested-async-plan-noend.js @@ -3,36 +3,36 @@ var test = require('../'); test('Harness async test support', function (t) { - t.plan(3); + t.plan(3); - t.ok(true, 'sync child A'); + t.ok(true, 'sync child A'); - t.test('sync child B', function (tt) { - tt.plan(2); + t.test('sync child B', function (tt) { + tt.plan(2); - setTimeout(function () { - tt.test('async grandchild A', function (ttt) { - ttt.plan(1); - ttt.ok(true); - }); - }, 50); + setTimeout(function () { + tt.test('async grandchild A', function (ttt) { + ttt.plan(1); + ttt.ok(true); + }); + }, 50); - setTimeout(function () { - tt.test('async grandchild B', function (ttt) { - ttt.plan(1); - ttt.ok(true); - }); - }, 100); - }); + setTimeout(function () { + tt.test('async grandchild B', function (ttt) { + ttt.plan(1); + ttt.ok(true); + }); + }, 100); + }); - setTimeout(function () { - t.test('async child', function (tt) { - tt.plan(2); - tt.ok(true, 'sync grandchild in async child A'); - tt.test('sync grandchild in async child B', function (ttt) { - ttt.plan(1); - ttt.ok(true); - }); - }); - }, 200); + setTimeout(function () { + t.test('async child', function (tt) { + tt.plan(2); + tt.ok(true, 'sync grandchild in async child A'); + tt.test('sync grandchild in async child B', function (ttt) { + ttt.plan(1); + ttt.ok(true); + }); + }); + }, 200); }); diff --git a/test/nested-sync-noplan-noend.js b/test/nested-sync-noplan-noend.js index 80a7da04..b64e7f55 100644 --- a/test/nested-sync-noplan-noend.js +++ b/test/nested-sync-noplan-noend.js @@ -5,41 +5,41 @@ var tap = require('tap'); var concat = require('concat-stream'); tap.test('nested sync test without plan or end', function (tt) { - tt.plan(1); + tt.plan(1); - var test = tape.createHarness(); - var tc = function (rows) { - tt.same(rows.toString('utf8'), [ - 'TAP version 13', - '# nested without plan or end', - '# first', - 'ok 1 should be truthy', - '# second', - 'ok 2 should be truthy', - '', - '1..2', - '# tests 2', - '# pass 2', - '', - '# ok' - ].join('\n') + '\n'); - }; + var test = tape.createHarness(); + var tc = function (rows) { + tt.same(rows.toString('utf8'), [ + 'TAP version 13', + '# nested without plan or end', + '# first', + 'ok 1 should be truthy', + '# second', + 'ok 2 should be truthy', + '', + '1..2', + '# tests 2', + '# pass 2', + '', + '# ok' + ].join('\n') + '\n'); + }; - test.createStream().pipe(concat(tc)); + test.createStream().pipe(concat(tc)); - test('nested without plan or end', function (t) { - t.test('first', function (q) { - setTimeout(function first() { - q.ok(true); - q.end(); - }, 10); - }); - t.test('second', function (q) { - setTimeout(function second() { - q.ok(true); - q.end(); - }, 10); - }); - }); + test('nested without plan or end', function (t) { + t.test('first', function (q) { + setTimeout(function first() { + q.ok(true); + q.end(); + }, 10); + }); + t.test('second', function (q) { + setTimeout(function second() { + q.ok(true); + q.end(); + }, 10); + }); + }); }); diff --git a/test/nested.js b/test/nested.js index a2b5a390..5fab23c5 100644 --- a/test/nested.js +++ b/test/nested.js @@ -6,80 +6,80 @@ var tap = require('tap'); var concat = require('concat-stream'); tap.test('array test', function (tt) { - tt.plan(1); + tt.plan(1); - var test = tape.createHarness(); - var tc = function (rows) { - tt.same(rows.toString('utf8'), [ - 'TAP version 13', - '# nested array test', - 'ok 1 should be equivalent', - 'ok 2 should be equivalent', - 'ok 3 should be equivalent', - 'ok 4 should be equivalent', - 'ok 5 should be equivalent', - '# inside test', - 'ok 6 should be truthy', - 'ok 7 should be truthy', - '# another', - 'ok 8 should be truthy', - '', - '1..8', - '# tests 8', - '# pass 8', - '', - '# ok' - ].join('\n') + '\n'); - }; + var test = tape.createHarness(); + var tc = function (rows) { + tt.same(rows.toString('utf8'), [ + 'TAP version 13', + '# nested array test', + 'ok 1 should be equivalent', + 'ok 2 should be equivalent', + 'ok 3 should be equivalent', + 'ok 4 should be equivalent', + 'ok 5 should be equivalent', + '# inside test', + 'ok 6 should be truthy', + 'ok 7 should be truthy', + '# another', + 'ok 8 should be truthy', + '', + '1..8', + '# tests 8', + '# pass 8', + '', + '# ok' + ].join('\n') + '\n'); + }; - test.createStream().pipe(concat(tc)); + test.createStream().pipe(concat(tc)); - test('nested array test', function (t) { - t.plan(6); + test('nested array test', function (t) { + t.plan(6); - var src = '(' + function () { - var xs = [1, 2, [3, 4]]; - var ys = [5, 6]; - g([xs, ys]); - } + ')()'; + var src = '(' + function () { + var xs = [1, 2, [3, 4]]; + var ys = [5, 6]; + g([xs, ys]); + } + ')()'; - var output = falafel(src, function (node) { - if (node.type === 'ArrayExpression') { - node.update('fn(' + node.source() + ')'); - } - }); + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); - t.test('inside test', function (q) { - q.plan(2); - q.ok(true); + t.test('inside test', function (q) { + q.plan(2); + q.ok(true); - setTimeout(function () { - q.ok(true); - }, 100); - }); + setTimeout(function () { + q.ok(true); + }, 100); + }); - var arrays = [ - [3, 4], - [1, 2, [3, 4]], - [5, 6], - [[1, 2, [3, 4]], [5, 6]] - ]; + var arrays = [ + [3, 4], + [1, 2, [3, 4]], + [5, 6], + [[1, 2, [3, 4]], [5, 6]] + ]; - Function(['fn', 'g'], output)( - function (xs) { - t.same(arrays.shift(), xs); - return xs; - }, - function (xs) { - t.same(xs, [[1, 2, [3, 4]], [5, 6]]); - } - ); - }); + Function(['fn', 'g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [[1, 2, [3, 4]], [5, 6]]); + } + ); + }); - test('another', function (t) { - t.plan(1); - setTimeout(function () { - t.ok(true); - }, 50); - }); + test('another', function (t) { + t.plan(1); + setTimeout(function () { + t.ok(true); + }, 50); + }); }); diff --git a/test/nested2.js b/test/nested2.js index f167df61..011467ec 100644 --- a/test/nested2.js +++ b/test/nested2.js @@ -3,18 +3,18 @@ var test = require('../'); test(function (t) { - var i = 0; - t.test('setup', function (st) { - process.nextTick(function () { - st.equal(i, 0, 'called once'); - i++; - st.end(); - }); - }); + var i = 0; + t.test('setup', function (st) { + process.nextTick(function () { + st.equal(i, 0, 'called once'); + i++; + st.end(); + }); + }); - t.test('teardown', function (st) { - st.end(); - }); + t.test('teardown', function (st) { + st.end(); + }); - t.end(); + t.end(); }); diff --git a/test/no_only.js b/test/no_only.js index d0f126ba..4e755c98 100644 --- a/test/no_only.js +++ b/test/no_only.js @@ -12,99 +12,99 @@ var expectedExitCodeFailure = (/^0\.10\.\d+$/).test(process.versions.node); var expectedStackTraceBug = (/^3\.[012]\.\d+$/).test(process.versions.node); // https://github.com/nodejs/node/issues/2581 tap.test( - 'Should throw error when --no-only is passed via cli and there is a .only test', - { todo: expectedExitCodeFailure || expectedStackTraceBug ? 'Fails on these node versions' : false }, - function (tt) { - tt.plan(3); + 'Should throw error when --no-only is passed via cli and there is a .only test', + { todo: expectedExitCodeFailure || expectedStackTraceBug ? 'Fails on these node versions' : false }, + function (tt) { + tt.plan(3); - exec(tapeBin + ' --no-only "**/*.js"', { - cwd: path.join(__dirname, 'no_only') - }, function (err, stdout, stderr) { - tt.same(stdout.toString('utf8'), ''); - tt.match(stripFullStack(stderr.toString('utf8')).join('\n'), /Error: `only` tests are prohibited\n/); - tt.equal(err.code, 1); - }); - } + exec(tapeBin + ' --no-only "**/*.js"', { + cwd: path.join(__dirname, 'no_only') + }, function (err, stdout, stderr) { + tt.same(stdout.toString('utf8'), ''); + tt.match(stripFullStack(stderr.toString('utf8')).join('\n'), /Error: `only` tests are prohibited\n/); + tt.equal(err.code, 1); + }); + } ); tap.test( - 'Should throw error when NODE_TAPE_NO_ONLY_TEST is passed via envs and there is an .only test', - { todo: expectedExitCodeFailure || expectedStackTraceBug ? 'Fails on these node versions' : false }, - function (tt) { - tt.plan(3); + 'Should throw error when NODE_TAPE_NO_ONLY_TEST is passed via envs and there is an .only test', + { todo: expectedExitCodeFailure || expectedStackTraceBug ? 'Fails on these node versions' : false }, + function (tt) { + tt.plan(3); - exec(tapeBin + ' "**/*.js"', { - cwd: path.join(__dirname, 'no_only'), - env: { PATH: process.env.PATH, NODE_TAPE_NO_ONLY_TEST: 'true' } - }, function (err, stdout, stderr) { - tt.same(stdout.toString('utf8'), ''); - tt.match(stripFullStack(stderr.toString('utf8')).join('\n'), /Error: `only` tests are prohibited\n/); - tt.equal(err.code, 1); - }); - } + exec(tapeBin + ' "**/*.js"', { + cwd: path.join(__dirname, 'no_only'), + env: { PATH: process.env.PATH, NODE_TAPE_NO_ONLY_TEST: 'true' } + }, function (err, stdout, stderr) { + tt.same(stdout.toString('utf8'), ''); + tt.match(stripFullStack(stderr.toString('utf8')).join('\n'), /Error: `only` tests are prohibited\n/); + tt.equal(err.code, 1); + }); + } ); tap.test( - 'Should override NODE_TAPE_NO_ONLY_TEST env if --no-only is passed from cli', - { todo: expectedExitCodeFailure || expectedStackTraceBug ? 'Fails on these node versions' : false }, - function (tt) { - tt.plan(3); + 'Should override NODE_TAPE_NO_ONLY_TEST env if --no-only is passed from cli', + { todo: expectedExitCodeFailure || expectedStackTraceBug ? 'Fails on these node versions' : false }, + function (tt) { + tt.plan(3); - exec(tapeBin + ' --no-only "**/*.js"', { - cwd: path.join(__dirname, 'no_only'), - env: { PATH: process.env.PATH, NODE_TAPE_NO_ONLY_TEST: 'false' } - }, function (err, stdout, stderr) { - tt.same(stdout.toString('utf8'), ''); - tt.match(stripFullStack(stderr.toString('utf8')).join('\n'), /Error: `only` tests are prohibited\n/); - tt.equal(err.code, 1); - }); - } + exec(tapeBin + ' --no-only "**/*.js"', { + cwd: path.join(__dirname, 'no_only'), + env: { PATH: process.env.PATH, NODE_TAPE_NO_ONLY_TEST: 'false' } + }, function (err, stdout, stderr) { + tt.same(stdout.toString('utf8'), ''); + tt.match(stripFullStack(stderr.toString('utf8')).join('\n'), /Error: `only` tests are prohibited\n/); + tt.equal(err.code, 1); + }); + } ); tap.test('Should run successfully if there is no only test', function (tt) { - tt.plan(3); + tt.plan(3); - exec(tapeBin + ' --no-only "**/test-a.js"', { - cwd: path.join(__dirname, 'no_only') - }, function (err, stdout, stderr) { - tt.match(stderr.toString('utf8'), /^\s*(\(node:\d+\) ExperimentalWarning: The ESM module loader is experimental\.)?\s*$/); - tt.same(stripFullStack(stdout.toString('utf8')), [ - 'TAP version 13', - '# should pass', - 'ok 1 should be truthy', - '', - '1..1', - '# tests 1', - '# pass 1', - '', - '# ok', - '', - '' - ]); - tt.equal(err, null); // code 0 - }); + exec(tapeBin + ' --no-only "**/test-a.js"', { + cwd: path.join(__dirname, 'no_only') + }, function (err, stdout, stderr) { + tt.match(stderr.toString('utf8'), /^\s*(\(node:\d+\) ExperimentalWarning: The ESM module loader is experimental\.)?\s*$/); + tt.same(stripFullStack(stdout.toString('utf8')), [ + 'TAP version 13', + '# should pass', + 'ok 1 should be truthy', + '', + '1..1', + '# tests 1', + '# pass 1', + '', + '# ok', + '', + '' + ]); + tt.equal(err, null); // code 0 + }); }); tap.test('Should run successfully if there is an only test and no --no-only flag', function (tt) { - tt.plan(3); + tt.plan(3); - exec(tapeBin + ' "**/test-b.js"', { - cwd: path.join(__dirname, 'no_only') - }, function (err, stdout, stderr) { - tt.same(stripFullStack(stdout.toString('utf8')), [ - 'TAP version 13', - '# should pass again', - 'ok 1 should be truthy', - '', - '1..1', - '# tests 1', - '# pass 1', - '', - '# ok', - '', - '' - ]); - tt.match(stderr.toString('utf8'), /^\s*(\(node:\d+\) ExperimentalWarning: The ESM module loader is experimental\.)?\s*$/); - tt.equal(err, null); // code 0 - }); + exec(tapeBin + ' "**/test-b.js"', { + cwd: path.join(__dirname, 'no_only') + }, function (err, stdout, stderr) { + tt.same(stripFullStack(stdout.toString('utf8')), [ + 'TAP version 13', + '# should pass again', + 'ok 1 should be truthy', + '', + '1..1', + '# tests 1', + '# pass 1', + '', + '# ok', + '', + '' + ]); + tt.match(stderr.toString('utf8'), /^\s*(\(node:\d+\) ExperimentalWarning: The ESM module loader is experimental\.)?\s*$/); + tt.equal(err, null); // code 0 + }); }); diff --git a/test/no_only/test-a.js b/test/no_only/test-a.js index 41107d38..db181572 100644 --- a/test/no_only/test-a.js +++ b/test/no_only/test-a.js @@ -3,6 +3,6 @@ var tape = require('../../'); tape.test('should pass', function (t) { - t.plan(1); - t.ok(1); + t.plan(1); + t.ok(1); }); diff --git a/test/no_only/test-b.js b/test/no_only/test-b.js index c6f6eb6e..d2aa5801 100644 --- a/test/no_only/test-b.js +++ b/test/no_only/test-b.js @@ -3,12 +3,12 @@ var tape = require('../../'); tape.test('should pass', function (t) { - t.plan(1); - t.ok(1); + t.plan(1); + t.ok(1); }); tape.test.only('should pass again', function (t) { - t.plan(1); - t.ok(1); + t.plan(1); + t.ok(1); }); diff --git a/test/not-deep-equal-failure.js b/test/not-deep-equal-failure.js index 40fcb9d9..465fec23 100644 --- a/test/not-deep-equal-failure.js +++ b/test/not-deep-equal-failure.js @@ -10,184 +10,184 @@ var getDiag = common.getDiag; var stripFullStack = common.stripFullStack; tap.test('deep equal failure', function (assert) { - var test = tape.createHarness({ exit: false }); - var stream = test.createStream(); - var parser = tapParser(); - assert.plan(3); - - stream.pipe(parser); - stream.pipe(concat(function (body) { - assert.same(stripFullStack(body.toString('utf8')), [ - 'TAP version 13', - '# not deep equal', - 'not ok 1 should not be equivalent', - ' ---', - ' operator: notDeepEqual', - ' expected: |-', - ' { b: 2 }', - ' actual: |-', - ' { b: 2 }', - ' at: Test. ($TEST/not-deep-equal-failure.js:$LINE:$COL)', - ' stack: |-', - ' Error: should not be equivalent', - ' [... stack stripped ...]', - ' at Test. ($TEST/not-deep-equal-failure.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - '', - '1..1', - '# tests 1', - '# pass 0', - '# fail 1', - '' - ]); - - assert.deepEqual(getDiag(body), { - operator: 'notDeepEqual', - expected: '{ b: 2 }', - actual: '{ b: 2 }' - }); - })); - - parser.once('assert', function (data) { - delete data.diag.stack; - delete data.diag.at; - assert.deepEqual(data, { - ok: false, - id: 1, - name: 'should not be equivalent', - diag: { - operator: 'notDeepEqual', - expected: '{ b: 2 }', - actual: '{ b: 2 }' - } - }); - }); - - test('not deep equal', function (t) { - t.plan(1); - t.notDeepEqual({ b: 2 }, { b: 2 }); - }); + var test = tape.createHarness({ exit: false }); + var stream = test.createStream(); + var parser = tapParser(); + assert.plan(3); + + stream.pipe(parser); + stream.pipe(concat(function (body) { + assert.same(stripFullStack(body.toString('utf8')), [ + 'TAP version 13', + '# not deep equal', + 'not ok 1 should not be equivalent', + ' ---', + ' operator: notDeepEqual', + ' expected: |-', + ' { b: 2 }', + ' actual: |-', + ' { b: 2 }', + ' at: Test. ($TEST/not-deep-equal-failure.js:$LINE:$COL)', + ' stack: |-', + ' Error: should not be equivalent', + ' [... stack stripped ...]', + ' at Test. ($TEST/not-deep-equal-failure.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + '', + '1..1', + '# tests 1', + '# pass 0', + '# fail 1', + '' + ]); + + assert.deepEqual(getDiag(body), { + operator: 'notDeepEqual', + expected: '{ b: 2 }', + actual: '{ b: 2 }' + }); + })); + + parser.once('assert', function (data) { + delete data.diag.stack; + delete data.diag.at; + assert.deepEqual(data, { + ok: false, + id: 1, + name: 'should not be equivalent', + diag: { + operator: 'notDeepEqual', + expected: '{ b: 2 }', + actual: '{ b: 2 }' + } + }); + }); + + test('not deep equal', function (t) { + t.plan(1); + t.notDeepEqual({ b: 2 }, { b: 2 }); + }); }); tap.test('not deep equal failure, depth 6, with option', function (assert) { - var test = tape.createHarness({ exit: false }); - var stream = test.createStream(); - var parser = tapParser(); - assert.plan(3); - - stream.pipe(parser); - stream.pipe(concat(function (body) { - assert.same(stripFullStack(body.toString('utf8')), [ - 'TAP version 13', - '# not deep equal', - 'not ok 1 should not be equivalent', - ' ---', - ' operator: notDeepEqual', - ' expected: |-', - ' { a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }', - ' actual: |-', - ' { a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }', - ' at: Test. ($TEST/not-deep-equal-failure.js:$LINE:$COL)', - ' stack: |-', - ' Error: should not be equivalent', - ' [... stack stripped ...]', - ' at Test. ($TEST/not-deep-equal-failure.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - '', - '1..1', - '# tests 1', - '# pass 0', - '# fail 1', - '' - ]); - - assert.deepEqual(getDiag(body), { - operator: 'notDeepEqual', - expected: '{ a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }', - actual: '{ a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }' - }); - })); - - parser.once('assert', function (data) { - delete data.diag.stack; - delete data.diag.at; - assert.deepEqual(data, { - ok: false, - id: 1, - name: 'should not be equivalent', - diag: { - operator: 'notDeepEqual', - expected: '{ a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }', - actual: '{ a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }' - } - }); - }); - - test('not deep equal', { objectPrintDepth: 6 }, function (t) { - t.plan(1); - t.notDeepEqual({ a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }, { a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }); - }); + var test = tape.createHarness({ exit: false }); + var stream = test.createStream(); + var parser = tapParser(); + assert.plan(3); + + stream.pipe(parser); + stream.pipe(concat(function (body) { + assert.same(stripFullStack(body.toString('utf8')), [ + 'TAP version 13', + '# not deep equal', + 'not ok 1 should not be equivalent', + ' ---', + ' operator: notDeepEqual', + ' expected: |-', + ' { a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }', + ' actual: |-', + ' { a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }', + ' at: Test. ($TEST/not-deep-equal-failure.js:$LINE:$COL)', + ' stack: |-', + ' Error: should not be equivalent', + ' [... stack stripped ...]', + ' at Test. ($TEST/not-deep-equal-failure.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + '', + '1..1', + '# tests 1', + '# pass 0', + '# fail 1', + '' + ]); + + assert.deepEqual(getDiag(body), { + operator: 'notDeepEqual', + expected: '{ a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }', + actual: '{ a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }' + }); + })); + + parser.once('assert', function (data) { + delete data.diag.stack; + delete data.diag.at; + assert.deepEqual(data, { + ok: false, + id: 1, + name: 'should not be equivalent', + diag: { + operator: 'notDeepEqual', + expected: '{ a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }', + actual: '{ a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }' + } + }); + }); + + test('not deep equal', { objectPrintDepth: 6 }, function (t) { + t.plan(1); + t.notDeepEqual({ a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }, { a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }); + }); }); tap.test('not deep equal failure, depth 6, without option', function (assert) { - var test = tape.createHarness({ exit: false }); - var stream = test.createStream(); - var parser = tapParser(); - assert.plan(3); - - stream.pipe(parser); - stream.pipe(concat(function (body) { - assert.same(stripFullStack(body.toString('utf8')), [ - 'TAP version 13', - '# not deep equal', - 'not ok 1 should not be equivalent', - ' ---', - ' operator: notDeepEqual', - ' expected: |-', - ' { a: { a1: { a2: { a3: { a4: [Object] } } } } }', - ' actual: |-', - ' { a: { a1: { a2: { a3: { a4: [Object] } } } } }', - ' at: Test. ($TEST/not-deep-equal-failure.js:$LINE:$COL)', - ' stack: |-', - ' Error: should not be equivalent', - ' [... stack stripped ...]', - ' at Test. ($TEST/not-deep-equal-failure.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - '', - '1..1', - '# tests 1', - '# pass 0', - '# fail 1', - '' - ]); - - assert.deepEqual(getDiag(body), { - operator: 'notDeepEqual', - expected: '{ a: { a1: { a2: { a3: { a4: [Object] } } } } }', - actual: '{ a: { a1: { a2: { a3: { a4: [Object] } } } } }' - }); - })); - - parser.once('assert', function (data) { - delete data.diag.stack; - delete data.diag.at; - assert.deepEqual(data, { - ok: false, - id: 1, - name: 'should not be equivalent', - diag: { - operator: 'notDeepEqual', - expected: '{ a: { a1: { a2: { a3: { a4: [Object] } } } } }', - actual: '{ a: { a1: { a2: { a3: { a4: [Object] } } } } }' - } - }); - }); - - test('not deep equal', function (t) { - t.plan(1); - t.notDeepEqual({ a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }, { a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }); - }); + var test = tape.createHarness({ exit: false }); + var stream = test.createStream(); + var parser = tapParser(); + assert.plan(3); + + stream.pipe(parser); + stream.pipe(concat(function (body) { + assert.same(stripFullStack(body.toString('utf8')), [ + 'TAP version 13', + '# not deep equal', + 'not ok 1 should not be equivalent', + ' ---', + ' operator: notDeepEqual', + ' expected: |-', + ' { a: { a1: { a2: { a3: { a4: [Object] } } } } }', + ' actual: |-', + ' { a: { a1: { a2: { a3: { a4: [Object] } } } } }', + ' at: Test. ($TEST/not-deep-equal-failure.js:$LINE:$COL)', + ' stack: |-', + ' Error: should not be equivalent', + ' [... stack stripped ...]', + ' at Test. ($TEST/not-deep-equal-failure.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + '', + '1..1', + '# tests 1', + '# pass 0', + '# fail 1', + '' + ]); + + assert.deepEqual(getDiag(body), { + operator: 'notDeepEqual', + expected: '{ a: { a1: { a2: { a3: { a4: [Object] } } } } }', + actual: '{ a: { a1: { a2: { a3: { a4: [Object] } } } } }' + }); + })); + + parser.once('assert', function (data) { + delete data.diag.stack; + delete data.diag.at; + assert.deepEqual(data, { + ok: false, + id: 1, + name: 'should not be equivalent', + diag: { + operator: 'notDeepEqual', + expected: '{ a: { a1: { a2: { a3: { a4: [Object] } } } } }', + actual: '{ a: { a1: { a2: { a3: { a4: [Object] } } } } }' + } + }); + }); + + test('not deep equal', function (t) { + t.plan(1); + t.notDeepEqual({ a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }, { a: { a1: { a2: { a3: { a4: { a5: 1 } } } } } }); + }); }); diff --git a/test/not-equal-failure.js b/test/not-equal-failure.js index 6db2861a..37e22d3a 100644 --- a/test/not-equal-failure.js +++ b/test/not-equal-failure.js @@ -10,60 +10,60 @@ var getDiag = common.getDiag; var stripFullStack = common.stripFullStack; tap.test('not equal failure', function (assert) { - var test = tape.createHarness({ exit: false }); - var stream = test.createStream(); - var parser = tapParser(); - assert.plan(3); + var test = tape.createHarness({ exit: false }); + var stream = test.createStream(); + var parser = tapParser(); + assert.plan(3); - stream.pipe(parser); - stream.pipe(concat(function (body) { - assert.same(stripFullStack(body.toString('utf8')), [ - 'TAP version 13', - '# not equal', - 'not ok 1 should not be equal', - ' ---', - ' operator: notEqual', - ' expected: 2', - ' actual: 2', - ' at: Test. ($TEST/not-equal-failure.js:$LINE:$COL)', - ' stack: |-', - ' Error: should not be equal', - ' [... stack stripped ...]', - ' at Test. ($TEST/not-equal-failure.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - '', - '1..1', - '# tests 1', - '# pass 0', - '# fail 1', - '' - ]); + stream.pipe(parser); + stream.pipe(concat(function (body) { + assert.same(stripFullStack(body.toString('utf8')), [ + 'TAP version 13', + '# not equal', + 'not ok 1 should not be equal', + ' ---', + ' operator: notEqual', + ' expected: 2', + ' actual: 2', + ' at: Test. ($TEST/not-equal-failure.js:$LINE:$COL)', + ' stack: |-', + ' Error: should not be equal', + ' [... stack stripped ...]', + ' at Test. ($TEST/not-equal-failure.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + '', + '1..1', + '# tests 1', + '# pass 0', + '# fail 1', + '' + ]); - assert.deepEqual(getDiag(body), { - operator: 'notEqual', - expected: '2', - actual: '2' - }); - })); + assert.deepEqual(getDiag(body), { + operator: 'notEqual', + expected: '2', + actual: '2' + }); + })); - parser.once('assert', function (data) { - delete data.diag.stack; - delete data.diag.at; - assert.deepEqual(data, { - ok: false, - id: 1, - name: 'should not be equal', - diag: { - operator: 'notEqual', - expected: '2', - actual: '2' - } - }); - }); + parser.once('assert', function (data) { + delete data.diag.stack; + delete data.diag.at; + assert.deepEqual(data, { + ok: false, + id: 1, + name: 'should not be equal', + diag: { + operator: 'notEqual', + expected: '2', + actual: '2' + } + }); + }); - test('not equal', function (t) { - t.plan(1); - t.notEqual(2, 2); - }); + test('not equal', function (t) { + t.plan(1); + t.notEqual(2, 2); + }); }); diff --git a/test/numerics.js b/test/numerics.js index b4e7ef32..98230dc4 100644 --- a/test/numerics.js +++ b/test/numerics.js @@ -7,178 +7,178 @@ var concat = require('concat-stream'); var stripFullStack = require('./common').stripFullStack; tap.test('numerics', function (tt) { - tt.plan(1); + tt.plan(1); - var test = tape.createHarness(); - test.createStream().pipe(concat(function (body) { - tt.same(stripFullStack(body.toString('utf8')), [ - 'TAP version 13', - '# numeric strings', - 'not ok 1 number equal to string', - ' ---', - ' operator: equal', - ' expected: \'3\'', - ' actual: 3', - ' at: Test. ($TEST/numerics.js:$LINE:$COL)', - ' stack: |-', - ' Error: number equal to string', - ' [... stack stripped ...]', - ' at Test. ($TEST/numerics.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 2 string equal to number', - ' ---', - ' operator: equal', - ' expected: 3', - ' actual: \'3\'', - ' at: Test. ($TEST/numerics.js:$LINE:$COL)', - ' stack: |-', - ' Error: string equal to number', - ' [... stack stripped ...]', - ' at Test. ($TEST/numerics.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'ok 3 number notEqual to string', - 'ok 4 string notEqual to number', - 'ok 5 number looseEqual to string', - 'ok 6 string looseEqual to number', - 'not ok 7 number notLooseEqual to string', - ' ---', - ' operator: notDeepLooseEqual', - ' expected: \'3\'', - ' actual: 3', - ' at: Test. ($TEST/numerics.js:$LINE:$COL)', - ' stack: |-', - ' Error: number notLooseEqual to string', - ' [... stack stripped ...]', - ' at Test. ($TEST/numerics.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 8 string notLooseEqual to number', - ' ---', - ' operator: notDeepLooseEqual', - ' expected: 3', - ' actual: \'3\'', - ' at: Test. ($TEST/numerics.js:$LINE:$COL)', - ' stack: |-', - ' Error: string notLooseEqual to number', - ' [... stack stripped ...]', - ' at Test. ($TEST/numerics.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 9 number strictEqual to string', - ' ---', - ' operator: equal', - ' expected: \'3\'', - ' actual: 3', - ' at: Test. ($TEST/numerics.js:$LINE:$COL)', - ' stack: |-', - ' Error: number strictEqual to string', - ' [... stack stripped ...]', - ' at Test. ($TEST/numerics.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 10 string strictEqual to number', - ' ---', - ' operator: equal', - ' expected: 3', - ' actual: \'3\'', - ' at: Test. ($TEST/numerics.js:$LINE:$COL)', - ' stack: |-', - ' Error: string strictEqual to number', - ' [... stack stripped ...]', - ' at Test. ($TEST/numerics.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'ok 11 number notStrictEqual to string', - 'ok 12 string notStrictEqual to number', - 'ok 13 number deepLooseEqual to string', - 'ok 14 string deepLooseEqual to number', - 'not ok 15 number notDeepLooseEqual to string', - ' ---', - ' operator: notDeepLooseEqual', - ' expected: \'3\'', - ' actual: 3', - ' at: Test. ($TEST/numerics.js:$LINE:$COL)', - ' stack: |-', - ' Error: number notDeepLooseEqual to string', - ' [... stack stripped ...]', - ' at Test. ($TEST/numerics.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 16 string notDeepLooseEqual to number', - ' ---', - ' operator: notDeepLooseEqual', - ' expected: 3', - ' actual: \'3\'', - ' at: Test. ($TEST/numerics.js:$LINE:$COL)', - ' stack: |-', - ' Error: string notDeepLooseEqual to number', - ' [... stack stripped ...]', - ' at Test. ($TEST/numerics.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 17 number deepEqual to string', - ' ---', - ' operator: deepEqual', - ' expected: \'3\'', - ' actual: 3', - ' at: Test. ($TEST/numerics.js:$LINE:$COL)', - ' stack: |-', - ' Error: number deepEqual to string', - ' [... stack stripped ...]', - ' at Test. ($TEST/numerics.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 18 string deepEqual to number', - ' ---', - ' operator: deepEqual', - ' expected: 3', - ' actual: \'3\'', - ' at: Test. ($TEST/numerics.js:$LINE:$COL)', - ' stack: |-', - ' Error: string deepEqual to number', - ' [... stack stripped ...]', - ' at Test. ($TEST/numerics.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'ok 19 number notDeepEqual to string', - 'ok 20 string notDeepEqual to number', - '', - '1..20', - '# tests 20', - '# pass 10', - '# fail 10', - '' - ]); - })); + var test = tape.createHarness(); + test.createStream().pipe(concat(function (body) { + tt.same(stripFullStack(body.toString('utf8')), [ + 'TAP version 13', + '# numeric strings', + 'not ok 1 number equal to string', + ' ---', + ' operator: equal', + ' expected: \'3\'', + ' actual: 3', + ' at: Test. ($TEST/numerics.js:$LINE:$COL)', + ' stack: |-', + ' Error: number equal to string', + ' [... stack stripped ...]', + ' at Test. ($TEST/numerics.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 2 string equal to number', + ' ---', + ' operator: equal', + ' expected: 3', + ' actual: \'3\'', + ' at: Test. ($TEST/numerics.js:$LINE:$COL)', + ' stack: |-', + ' Error: string equal to number', + ' [... stack stripped ...]', + ' at Test. ($TEST/numerics.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'ok 3 number notEqual to string', + 'ok 4 string notEqual to number', + 'ok 5 number looseEqual to string', + 'ok 6 string looseEqual to number', + 'not ok 7 number notLooseEqual to string', + ' ---', + ' operator: notDeepLooseEqual', + ' expected: \'3\'', + ' actual: 3', + ' at: Test. ($TEST/numerics.js:$LINE:$COL)', + ' stack: |-', + ' Error: number notLooseEqual to string', + ' [... stack stripped ...]', + ' at Test. ($TEST/numerics.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 8 string notLooseEqual to number', + ' ---', + ' operator: notDeepLooseEqual', + ' expected: 3', + ' actual: \'3\'', + ' at: Test. ($TEST/numerics.js:$LINE:$COL)', + ' stack: |-', + ' Error: string notLooseEqual to number', + ' [... stack stripped ...]', + ' at Test. ($TEST/numerics.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 9 number strictEqual to string', + ' ---', + ' operator: equal', + ' expected: \'3\'', + ' actual: 3', + ' at: Test. ($TEST/numerics.js:$LINE:$COL)', + ' stack: |-', + ' Error: number strictEqual to string', + ' [... stack stripped ...]', + ' at Test. ($TEST/numerics.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 10 string strictEqual to number', + ' ---', + ' operator: equal', + ' expected: 3', + ' actual: \'3\'', + ' at: Test. ($TEST/numerics.js:$LINE:$COL)', + ' stack: |-', + ' Error: string strictEqual to number', + ' [... stack stripped ...]', + ' at Test. ($TEST/numerics.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'ok 11 number notStrictEqual to string', + 'ok 12 string notStrictEqual to number', + 'ok 13 number deepLooseEqual to string', + 'ok 14 string deepLooseEqual to number', + 'not ok 15 number notDeepLooseEqual to string', + ' ---', + ' operator: notDeepLooseEqual', + ' expected: \'3\'', + ' actual: 3', + ' at: Test. ($TEST/numerics.js:$LINE:$COL)', + ' stack: |-', + ' Error: number notDeepLooseEqual to string', + ' [... stack stripped ...]', + ' at Test. ($TEST/numerics.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 16 string notDeepLooseEqual to number', + ' ---', + ' operator: notDeepLooseEqual', + ' expected: 3', + ' actual: \'3\'', + ' at: Test. ($TEST/numerics.js:$LINE:$COL)', + ' stack: |-', + ' Error: string notDeepLooseEqual to number', + ' [... stack stripped ...]', + ' at Test. ($TEST/numerics.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 17 number deepEqual to string', + ' ---', + ' operator: deepEqual', + ' expected: \'3\'', + ' actual: 3', + ' at: Test. ($TEST/numerics.js:$LINE:$COL)', + ' stack: |-', + ' Error: number deepEqual to string', + ' [... stack stripped ...]', + ' at Test. ($TEST/numerics.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 18 string deepEqual to number', + ' ---', + ' operator: deepEqual', + ' expected: 3', + ' actual: \'3\'', + ' at: Test. ($TEST/numerics.js:$LINE:$COL)', + ' stack: |-', + ' Error: string deepEqual to number', + ' [... stack stripped ...]', + ' at Test. ($TEST/numerics.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'ok 19 number notDeepEqual to string', + 'ok 20 string notDeepEqual to number', + '', + '1..20', + '# tests 20', + '# pass 10', + '# fail 10', + '' + ]); + })); - test('numeric strings', function (t) { - t.equal(3, '3', 'number equal to string'); - t.equal('3', 3, 'string equal to number'); - t.notEqual(3, '3', 'number notEqual to string'); - t.notEqual('3', 3, 'string notEqual to number'); + test('numeric strings', function (t) { + t.equal(3, '3', 'number equal to string'); + t.equal('3', 3, 'string equal to number'); + t.notEqual(3, '3', 'number notEqual to string'); + t.notEqual('3', 3, 'string notEqual to number'); - t.looseEqual(3, '3', 'number looseEqual to string'); - t.looseEqual('3', 3, 'string looseEqual to number'); - t.notLooseEqual(3, '3', 'number notLooseEqual to string'); - t.notLooseEqual('3', 3, 'string notLooseEqual to number'); + t.looseEqual(3, '3', 'number looseEqual to string'); + t.looseEqual('3', 3, 'string looseEqual to number'); + t.notLooseEqual(3, '3', 'number notLooseEqual to string'); + t.notLooseEqual('3', 3, 'string notLooseEqual to number'); - t.strictEqual(3, '3', 'number strictEqual to string'); - t.strictEqual('3', 3, 'string strictEqual to number'); - t.notStrictEqual(3, '3', 'number notStrictEqual to string'); - t.notStrictEqual('3', 3, 'string notStrictEqual to number'); + t.strictEqual(3, '3', 'number strictEqual to string'); + t.strictEqual('3', 3, 'string strictEqual to number'); + t.notStrictEqual(3, '3', 'number notStrictEqual to string'); + t.notStrictEqual('3', 3, 'string notStrictEqual to number'); - t.deepLooseEqual(3, '3', 'number deepLooseEqual to string'); - t.deepLooseEqual('3', 3, 'string deepLooseEqual to number'); - t.notDeepLooseEqual(3, '3', 'number notDeepLooseEqual to string'); - t.notDeepLooseEqual('3', 3, 'string notDeepLooseEqual to number'); + t.deepLooseEqual(3, '3', 'number deepLooseEqual to string'); + t.deepLooseEqual('3', 3, 'string deepLooseEqual to number'); + t.notDeepLooseEqual(3, '3', 'number notDeepLooseEqual to string'); + t.notDeepLooseEqual('3', 3, 'string notDeepLooseEqual to number'); - t.deepEqual(3, '3', 'number deepEqual to string'); - t.deepEqual('3', 3, 'string deepEqual to number'); - t.notDeepEqual(3, '3', 'number notDeepEqual to string'); - t.notDeepEqual('3', 3, 'string notDeepEqual to number'); + t.deepEqual(3, '3', 'number deepEqual to string'); + t.deepEqual('3', 3, 'string deepEqual to number'); + t.notDeepEqual(3, '3', 'number notDeepEqual to string'); + t.notDeepEqual('3', 3, 'string notDeepEqual to number'); - t.end(); - }); + t.end(); + }); }); diff --git a/test/objectMode.js b/test/objectMode.js index fd71d8cc..eb7eddf1 100644 --- a/test/objectMode.js +++ b/test/objectMode.js @@ -6,66 +6,66 @@ var forEach = require('for-each'); var through = require('through'); tap.test('object results', function (assert) { - var printer = through({ objectMode: true }); - var objects = []; + var printer = through({ objectMode: true }); + var objects = []; - printer.write = function (obj) { - objects.push(obj); - }; + printer.write = function (obj) { + objects.push(obj); + }; - printer.end = function (obj) { - if (obj) { objects.push(obj); } + printer.end = function (obj) { + if (obj) { objects.push(obj); } - var todos = 0; - var skips = 0; - var testIds = []; - var endIds = []; - var asserts = 0; + var todos = 0; + var skips = 0; + var testIds = []; + var endIds = []; + var asserts = 0; - assert.equal(objects.length, 13); + assert.equal(objects.length, 13); - forEach(objects, function (object) { - if (object.type === 'assert') { - asserts++; - } else if (object.type === 'test') { - testIds.push(object.id); + forEach(objects, function (object) { + if (object.type === 'assert') { + asserts++; + } else if (object.type === 'test') { + testIds.push(object.id); - if (object.skip) { - skips++; - } else if (object.todo) { - todos++; - } - } else if (object.type === 'end') { - endIds.push(object.text); - // test object should exist - assert.notEqual(testIds.indexOf(object.test), -1); - } - }); + if (object.skip) { + skips++; + } else if (object.todo) { + todos++; + } + } else if (object.type === 'end') { + endIds.push(object.text); + // test object should exist + assert.notEqual(testIds.indexOf(object.test), -1); + } + }); - assert.equal(asserts, 5); - assert.equal(skips, 1); - assert.equal(todos, 2); - assert.equal(testIds.length, endIds.length); - assert.end(); - }; + assert.equal(asserts, 5); + assert.equal(skips, 1); + assert.equal(todos, 2); + assert.equal(testIds.length, endIds.length); + assert.end(); + }; - tape.createStream({ objectMode: true }).pipe(printer); + tape.createStream({ objectMode: true }).pipe(printer); - tape('parent', function (t1) { - t1.equal(true, true); - t1.test('child1', { skip: true }, function (t2) { - t2.equal(true, true); - t2.equal(true, false); - t2.end(); - }); - t1.test('child2', { todo: true }, function (t3) { - t3.equal(true, false); - t3.equal(true, true); - t3.end(); - }); - t1.test('child3', { todo: true }); - t1.equal(true, true); - t1.equal(true, true); - t1.end(); - }); + tape('parent', function (t1) { + t1.equal(true, true); + t1.test('child1', { skip: true }, function (t2) { + t2.equal(true, true); + t2.equal(true, false); + t2.end(); + }); + t1.test('child2', { todo: true }, function (t3) { + t3.equal(true, false); + t3.equal(true, true); + t3.end(); + }); + t1.test('child3', { todo: true }); + t1.equal(true, true); + t1.equal(true, true); + t1.end(); + }); }); diff --git a/test/objectModeWithComment.js b/test/objectModeWithComment.js index 9a34f270..b00f0779 100644 --- a/test/objectModeWithComment.js +++ b/test/objectModeWithComment.js @@ -5,37 +5,37 @@ var tape = require('../'); var through = require('through'); tap.test('test.comment() in objectMode', function (assert) { - var printer = through({ objectMode: true }); - var objects = []; - printer.on('error', function (e) { - assert.fail(e); - }); + var printer = through({ objectMode: true }); + var objects = []; + printer.on('error', function (e) { + assert.fail(e); + }); - printer.write = function (obj) { - objects.push(obj); - }; - printer.end = function (obj) { - if (obj) { objects.push(obj); } + printer.write = function (obj) { + objects.push(obj); + }; + printer.end = function (obj) { + if (obj) { objects.push(obj); } - assert.equal(objects.length, 3); - assert.deepEqual(objects, [ - { - type: 'test', - name: 'test.comment', - id: 0, - skip: false, - todo: false - }, - 'message', - { type: 'end', test: 0 } - ]); - assert.end(); - }; + assert.equal(objects.length, 3); + assert.deepEqual(objects, [ + { + type: 'test', + name: 'test.comment', + id: 0, + skip: false, + todo: false + }, + 'message', + { type: 'end', test: 0 } + ]); + assert.end(); + }; - tape.createStream({ objectMode: true }).pipe(printer); + tape.createStream({ objectMode: true }).pipe(printer); - tape('test.comment', function (test) { - test.comment('message'); - test.end(); - }); + tape('test.comment', function (test) { + test.comment('message'); + test.end(); + }); }); diff --git a/test/onFailure.js b/test/onFailure.js index 0d7c1cc0..dd5135e2 100644 --- a/test/onFailure.js +++ b/test/onFailure.js @@ -10,14 +10,14 @@ var mockSink = { on: noop, removeListener: noop, emit: noop, end: noop }; tape.createStream().pipe(mockSink); tap.test('on failure', { timeout: 1000 }, function (tt) { - tt.plan(1); + tt.plan(1); - tape('dummy test', function (t) { - t.fail(); - t.end(); - }); + tape('dummy test', function (t) { + t.fail(); + t.end(); + }); - tape.onFailure(function () { - tt.pass('tape ended'); - }); + tape.onFailure(function () { + tt.pass('tape ended'); + }); }); diff --git a/test/onFinish.js b/test/onFinish.js index db3b7609..b54e265a 100644 --- a/test/onFinish.js +++ b/test/onFinish.js @@ -4,11 +4,11 @@ var tap = require('tap'); var tape = require('../'); tap.test('on finish', { timeout: 1000 }, function (tt) { - tt.plan(1); - tape.onFinish(function () { - tt.pass('tape ended'); - }); - tape('dummy test', function (t) { - t.end(); - }); + tt.plan(1); + tape.onFinish(function () { + tt.pass('tape ended'); + }); + tape('dummy test', function (t) { + t.end(); + }); }); diff --git a/test/only-twice.js b/test/only-twice.js index 98008c90..f4e3a8ba 100644 --- a/test/only-twice.js +++ b/test/only-twice.js @@ -4,19 +4,19 @@ var tape = require('../'); var tap = require('tap'); tap.test('only twice error', function (assert) { - var test = tape.createHarness({ exit: false }); + var test = tape.createHarness({ exit: false }); - test.only('first only', function (t) { - t.end(); - }); + test.only('first only', function (t) { + t.end(); + }); - assert['throws'](function () { - test.only('second only', function (t) { - t.end(); - }); - }, { - name: 'Error', - message: 'there can only be one only test' - }); - assert.end(); + assert['throws'](function () { + test.only('second only', function (t) { + t.end(); + }); + }, { + name: 'Error', + message: 'there can only be one only test' + }); + assert.end(); }); diff --git a/test/only.js b/test/only.js index 27253efa..3254d457 100644 --- a/test/only.js +++ b/test/only.js @@ -5,43 +5,43 @@ var tape = require('../'); var concat = require('concat-stream'); tap.test('tape only test', function (tt) { - var test = tape.createHarness({ exit: false }); - var ran = []; - - var tc = function (rows) { - tt.deepEqual(rows.toString('utf8'), [ - 'TAP version 13', - '# run success', - 'ok 1 assert name', - '', - '1..1', - '# tests 1', - '# pass 1', - '', - '# ok' - ].join('\n') + '\n'); - tt.deepEqual(ran, [3]); - - tt.end(); - }; - - test.createStream().pipe(concat(tc)); - - test('never run fail', function (t) { - ran.push(1); - t.equal(true, false); - t.end(); - }); - - test('never run success', function (t) { - ran.push(2); - t.equal(true, true); - t.end(); - }); - - test.only('run success', function (t) { - ran.push(3); - t.ok(true, 'assert name'); - t.end(); - }); + var test = tape.createHarness({ exit: false }); + var ran = []; + + var tc = function (rows) { + tt.deepEqual(rows.toString('utf8'), [ + 'TAP version 13', + '# run success', + 'ok 1 assert name', + '', + '1..1', + '# tests 1', + '# pass 1', + '', + '# ok' + ].join('\n') + '\n'); + tt.deepEqual(ran, [3]); + + tt.end(); + }; + + test.createStream().pipe(concat(tc)); + + test('never run fail', function (t) { + ran.push(1); + t.equal(true, false); + t.end(); + }); + + test('never run success', function (t) { + ran.push(2); + t.equal(true, true); + t.end(); + }); + + test.only('run success', function (t) { + ran.push(3); + t.ok(true, 'assert name'); + t.end(); + }); }); diff --git a/test/only2.js b/test/only2.js index bf629978..494e6004 100644 --- a/test/only2.js +++ b/test/only2.js @@ -3,9 +3,9 @@ var test = require('../'); test('only2 test 1', function (t) { - t.end(); + t.end(); }); test.only('only2 test 2', function (t) { - t.end(); + t.end(); }); diff --git a/test/only3.js b/test/only3.js index 6c73ef83..01cfb041 100644 --- a/test/only3.js +++ b/test/only3.js @@ -3,15 +3,15 @@ var test = require('../'); test('only3 test 1', function (t) { - t.fail('not 1'); - t.end(); + t.fail('not 1'); + t.end(); }); test.only('only3 test 2', function (t) { - t.end(); + t.end(); }); test('only3 test 3', function (t) { - t.fail('not 3'); - t.end(); + t.fail('not 3'); + t.end(); }); diff --git a/test/only4.js b/test/only4.js index b4362124..fa96b02e 100644 --- a/test/only4.js +++ b/test/only4.js @@ -3,10 +3,10 @@ var test = require('../'); test('only4 duplicate test name', function (t) { - t.fail('not 1'); - t.end(); + t.fail('not 1'); + t.end(); }); test.only('only4 duplicate test name', function (t) { - t.end(); + t.end(); }); diff --git a/test/only5.js b/test/only5.js index abbfbe20..272b1ae2 100644 --- a/test/only5.js +++ b/test/only5.js @@ -3,10 +3,10 @@ var test = require('../'); test.only('only5 duplicate test name', function (t) { - t.end(); + t.end(); }); test('only5 duplicate test name', function (t) { - t.fail('not 2'); - t.end(); + t.fail('not 2'); + t.end(); }); diff --git a/test/order.js b/test/order.js index 5c0ea715..e1f67292 100644 --- a/test/order.js +++ b/test/order.js @@ -4,16 +4,16 @@ var test = require('../'); var current = 0; test(function (t) { - t.equal(current++, 0); - t.end(); + t.equal(current++, 0); + t.end(); }); test(function (t) { - t.plan(1); - setTimeout(function () { - t.equal(current++, 1); - }, 100); + t.plan(1); + setTimeout(function () { + t.equal(current++, 1); + }, 100); }); test(function (t) { - t.equal(current++, 2); - t.end(); + t.equal(current++, 2); + t.end(); }); diff --git a/test/plan_optional.js b/test/plan_optional.js index 6731f269..abd8b367 100644 --- a/test/plan_optional.js +++ b/test/plan_optional.js @@ -3,15 +3,15 @@ var test = require('../'); test('plan should be optional', function (t) { - t.pass('no plan here'); - t.end(); + t.pass('no plan here'); + t.end(); }); test('no plan async', function (t) { - setTimeout(function () { - t.pass('ok'); - t.end(); - }, 100); + setTimeout(function () { + t.pass('ok'); + t.end(); + }, 100); }); // vim: set softtabstop=4 shiftwidth=4: diff --git a/test/require.js b/test/require.js index 14014cdd..724f40cf 100644 --- a/test/require.js +++ b/test/require.js @@ -5,66 +5,66 @@ var spawn = require('child_process').spawn; var concat = require('concat-stream'); tap.test('requiring a single module', function (t) { - t.plan(2); + t.plan(2); - var tc = function (rows) { - t.same(rows.toString('utf8'), [ - 'TAP version 13', - '# module-a', - 'ok 1 loaded module a', - '# test-a', - 'ok 2 module-a loaded in same context', - 'ok 3 test ran after module-a was loaded', - '', - '1..3', - '# tests 3', - '# pass 3', - '', - '# ok' - ].join('\n') + '\n\n'); - }; + var tc = function (rows) { + t.same(rows.toString('utf8'), [ + 'TAP version 13', + '# module-a', + 'ok 1 loaded module a', + '# test-a', + 'ok 2 module-a loaded in same context', + 'ok 3 test ran after module-a was loaded', + '', + '1..3', + '# tests 3', + '# pass 3', + '', + '# ok' + ].join('\n') + '\n\n'); + }; - var ps = tape('-r ./require/a require/test-a.js'); - ps.stdout.pipe(concat(tc)); - ps.on('exit', function (code) { - t.equal(code, 0); - }); + var ps = tape('-r ./require/a require/test-a.js'); + ps.stdout.pipe(concat(tc)); + ps.on('exit', function (code) { + t.equal(code, 0); + }); }); tap.test('requiring multiple modules', function (t) { - t.plan(2); + t.plan(2); - var tc = function (rows) { - t.same(rows.toString('utf8'), [ - 'TAP version 13', - '# module-a', - 'ok 1 loaded module a', - '# module-b', - 'ok 2 loaded module b', - '# test-a', - 'ok 3 module-a loaded in same context', - 'ok 4 test ran after module-a was loaded', - '# test-b', - 'ok 5 module-b loaded in same context', - 'ok 6 test ran after module-b was loaded', - '', - '1..6', - '# tests 6', - '# pass 6', - '', - '# ok' - ].join('\n') + '\n\n'); - }; + var tc = function (rows) { + t.same(rows.toString('utf8'), [ + 'TAP version 13', + '# module-a', + 'ok 1 loaded module a', + '# module-b', + 'ok 2 loaded module b', + '# test-a', + 'ok 3 module-a loaded in same context', + 'ok 4 test ran after module-a was loaded', + '# test-b', + 'ok 5 module-b loaded in same context', + 'ok 6 test ran after module-b was loaded', + '', + '1..6', + '# tests 6', + '# pass 6', + '', + '# ok' + ].join('\n') + '\n\n'); + }; - var ps = tape('-r ./require/a -r ./require/b require/test-a.js require/test-b.js'); - ps.stdout.pipe(concat(tc)); - ps.on('exit', function (code) { - t.equal(code, 0); - }); + var ps = tape('-r ./require/a -r ./require/b require/test-a.js require/test-b.js'); + ps.stdout.pipe(concat(tc)); + ps.on('exit', function (code) { + t.equal(code, 0); + }); }); function tape(args) { - var bin = __dirname + '/../bin/tape'; + var bin = __dirname + '/../bin/tape'; - return spawn('node', [bin].concat(args.split(' ')), { cwd: __dirname }); + return spawn('node', [bin].concat(args.split(' ')), { cwd: __dirname }); } diff --git a/test/require/a.js b/test/require/a.js index f4d87453..f1c23c74 100644 --- a/test/require/a.js +++ b/test/require/a.js @@ -3,8 +3,8 @@ var tape = require('../..'); tape.test('module-a', function (t) { - t.plan(1); - t.pass('loaded module a'); + t.plan(1); + t.pass('loaded module a'); }); global.module_a = true; diff --git a/test/require/b.js b/test/require/b.js index f7fe3b1c..6a2d1b52 100644 --- a/test/require/b.js +++ b/test/require/b.js @@ -3,8 +3,8 @@ var tape = require('../..'); tape.test('module-b', function (t) { - t.plan(1); - t.pass('loaded module b'); + t.plan(1); + t.pass('loaded module b'); }); global.module_b = true; diff --git a/test/require/test-a.js b/test/require/test-a.js index bcf15ca9..04834510 100644 --- a/test/require/test-a.js +++ b/test/require/test-a.js @@ -3,7 +3,7 @@ var tape = require('../..'); tape.test('test-a', function (t) { - t.ok(global.module_a, 'module-a loaded in same context'); - t.pass('test ran after module-a was loaded'); - t.end(); + t.ok(global.module_a, 'module-a loaded in same context'); + t.pass('test ran after module-a was loaded'); + t.end(); }); diff --git a/test/require/test-b.js b/test/require/test-b.js index 6cd57bfd..552565f7 100644 --- a/test/require/test-b.js +++ b/test/require/test-b.js @@ -3,7 +3,7 @@ var tape = require('../..'); tape.test('test-b', function (t) { - t.ok(global.module_b, 'module-b loaded in same context'); - t.pass('test ran after module-b was loaded'); - t.end(); + t.ok(global.module_b, 'module-b loaded in same context'); + t.pass('test ran after module-b was loaded'); + t.end(); }); diff --git a/test/skip.js b/test/skip.js index d0843599..2260027a 100644 --- a/test/skip.js +++ b/test/skip.js @@ -6,45 +6,45 @@ var concat = require('concat-stream'); var tap = require('tap'); tap.test('test SKIP comment', function (assert) { - assert.plan(1); - - var verify = function (output) { - assert.equal(output.toString('utf8'), [ - 'TAP version 13', - '# SKIP skipped', - '', - '1..0', - '# tests 0', - '# pass 0', - '', - '# ok', - '' - ].join('\n')); - }; - - var tapeTest = test.createHarness(); - tapeTest.createStream().pipe(concat(verify)); - tapeTest('skipped', { skip: true }, function (t) { - t.end(); - }); + assert.plan(1); + + var verify = function (output) { + assert.equal(output.toString('utf8'), [ + 'TAP version 13', + '# SKIP skipped', + '', + '1..0', + '# tests 0', + '# pass 0', + '', + '# ok', + '' + ].join('\n')); + }; + + var tapeTest = test.createHarness(); + tapeTest.createStream().pipe(concat(verify)); + tapeTest('skipped', { skip: true }, function (t) { + t.end(); + }); }); test('skip this', { skip: true }, function (t) { - t.fail('this should not even run'); - t.end(); + t.fail('this should not even run'); + t.end(); }); test.skip('skip this too', function (t) { - t.fail('this should not even run'); - t.end(); + t.fail('this should not even run'); + t.end(); }); test('skip subtest', function (t) { - t.test('skip this', { skip: true }, function (st) { - st.fail('this should not even run'); - st.end(); - }); - t.end(); + t.test('skip this', { skip: true }, function (st) { + st.fail('this should not even run'); + st.end(); + }); + t.end(); }); // vim: set softtabstop=4 shiftwidth=4: diff --git a/test/skip_explanation.js b/test/skip_explanation.js index 544d3056..a3ea6306 100644 --- a/test/skip_explanation.js +++ b/test/skip_explanation.js @@ -6,80 +6,80 @@ var concat = require('concat-stream'); var stripFullStack = require('./common').stripFullStack; tap.test('test skip explanations', function (assert) { - assert.plan(1); + assert.plan(1); - var verify = function (output) { - assert.same(stripFullStack(output.toString('utf8')), [ - 'TAP version 13', - '# SKIP (this skips)', - '# some tests might skip', - 'ok 1 this runs', - 'ok 2 failing assert is skipped # SKIP', - 'ok 3 this runs', - '# incomplete test', - 'ok 4 run sh', - 'ok 5 run openssl # SKIP', - '# incomplete test with explanation', - 'ok 6 run sh (conditional skip) # SKIP', - 'ok 7 run openssl # SKIP can\'t run on windows platforms', - 'ok 8 this runs', - '# too much explanation', - 'ok 9 run openssl # SKIP Installer cannot work on windows and fails to add to PATH Err: (2401) denied', - '', - '1..9', - '# tests 9', - '# pass 9', - '', - '# ok', - '' - ]); - }; + var verify = function (output) { + assert.same(stripFullStack(output.toString('utf8')), [ + 'TAP version 13', + '# SKIP (this skips)', + '# some tests might skip', + 'ok 1 this runs', + 'ok 2 failing assert is skipped # SKIP', + 'ok 3 this runs', + '# incomplete test', + 'ok 4 run sh', + 'ok 5 run openssl # SKIP', + '# incomplete test with explanation', + 'ok 6 run sh (conditional skip) # SKIP', + 'ok 7 run openssl # SKIP can\'t run on windows platforms', + 'ok 8 this runs', + '# too much explanation', + 'ok 9 run openssl # SKIP Installer cannot work on windows and fails to add to PATH Err: (2401) denied', + '', + '1..9', + '# tests 9', + '# pass 9', + '', + '# ok', + '' + ]); + }; - var tapeTest = test.createHarness(); - tapeTest.createStream().pipe(concat(verify)); + var tapeTest = test.createHarness(); + tapeTest.createStream().pipe(concat(verify)); - tapeTest('(this skips)', { skip: true }, function (t) { - t.fail('doesn\'t run'); - t.fail('this doesn\'t run too', { skip: false }); - t.end(); - }); + tapeTest('(this skips)', { skip: true }, function (t) { + t.fail('doesn\'t run'); + t.fail('this doesn\'t run too', { skip: false }); + t.end(); + }); - tapeTest('some tests might skip', function (t) { - t.pass('this runs'); - t.fail('failing assert is skipped', { skip: true }); - t.pass('this runs'); - t.end(); - }); + tapeTest('some tests might skip', function (t) { + t.pass('this runs'); + t.fail('failing assert is skipped', { skip: true }); + t.pass('this runs'); + t.end(); + }); - tapeTest('incomplete test', function (t) { - // var platform = process.platform; something like this needed - var platform = 'win32'; + tapeTest('incomplete test', function (t) { + // var platform = process.platform; something like this needed + var platform = 'win32'; - t.pass('run sh', { skip: platform !== 'win32' }); - t.pass('run openssl', { skip: platform === 'win32' }); - t.end(); - }); + t.pass('run sh', { skip: platform !== 'win32' }); + t.pass('run openssl', { skip: platform === 'win32' }); + t.end(); + }); - tapeTest('incomplete test with explanation', function (t) { - // var platform = process.platform; something like this needed - var platform = 'win32'; + tapeTest('incomplete test with explanation', function (t) { + // var platform = process.platform; something like this needed + var platform = 'win32'; - t.fail('run sh (conditional skip)', { skip: platform === 'win32' }); - t.fail('run openssl', { skip: platform === 'win32' && 'can\'t run on windows platforms' }); - t.pass('this runs'); - t.end(); - }); + t.fail('run sh (conditional skip)', { skip: platform === 'win32' }); + t.fail('run openssl', { skip: platform === 'win32' && 'can\'t run on windows platforms' }); + t.pass('this runs'); + t.end(); + }); - tapeTest('too much explanation', function (t) { - // var platform = process.platform; something like this needed - var platform = 'win32'; + tapeTest('too much explanation', function (t) { + // var platform = process.platform; something like this needed + var platform = 'win32'; - t.fail( - 'run openssl', - { skip: platform === 'win32' && 'Installer cannot work on windows\nand fails to add to PATH\n\n Err: (2401) denied' } - ); - t.end(); - }); + t.fail( + 'run openssl', + { skip: platform === 'win32' && 'Installer cannot work on windows\nand fails to add to PATH\n\n Err: (2401) denied' } + ); + t.end(); + }); }); // vim: set softtabstop=4 shiftwidth=4: diff --git a/test/stackTrace.js b/test/stackTrace.js index 8ae0ee6b..b55afff4 100644 --- a/test/stackTrace.js +++ b/test/stackTrace.js @@ -7,33 +7,33 @@ var tapParser = require('tap-parser'); var yaml = require('js-yaml'); tap.test('preserves stack trace with newlines', function (tt) { - tt.plan(3); - - var test = tape.createHarness(); - var stream = test.createStream(); - var parser = stream.pipe(tapParser()); - var stackTrace = 'foo\n bar'; - - parser.once('assert', function (data) { - delete data.diag.at; - tt.deepEqual(data, { - ok: false, - id: 1, - name: 'Error: Preserve stack', - diag: { - stack: stackTrace, - operator: 'error', - expected: 'undefined', - actual: '[Error: Preserve stack]' - } - }); - }); - - stream.pipe(concat(function (body) { - var strippedBody = stripAt(body.toString('utf8')); - tt.equal( - strippedBody, - 'TAP version 13\n' + tt.plan(3); + + var test = tape.createHarness(); + var stream = test.createStream(); + var parser = stream.pipe(tapParser()); + var stackTrace = 'foo\n bar'; + + parser.once('assert', function (data) { + delete data.diag.at; + tt.deepEqual(data, { + ok: false, + id: 1, + name: 'Error: Preserve stack', + diag: { + stack: stackTrace, + operator: 'error', + expected: 'undefined', + actual: '[Error: Preserve stack]' + } + }); + }); + + stream.pipe(concat(function (body) { + var strippedBody = stripAt(body.toString('utf8')); + tt.equal( + strippedBody, + 'TAP version 13\n' + '# multiline stack trace\n' + 'not ok 1 Error: Preserve stack\n' + ' ---\n' @@ -51,153 +51,153 @@ tap.test('preserves stack trace with newlines', function (tt) { + '# tests 1\n' + '# pass 0\n' + '# fail 1\n' - ); - - tt.deepEqual(getDiag(strippedBody), { - stack: stackTrace, - operator: 'error', - expected: 'undefined', - actual: '[Error: Preserve stack]' - }); - })); - - test('multiline stack trace', function (t) { - t.plan(1); - var err = new Error('Preserve stack'); - err.stack = stackTrace; - t.error(err); - }); + ); + + tt.deepEqual(getDiag(strippedBody), { + stack: stackTrace, + operator: 'error', + expected: 'undefined', + actual: '[Error: Preserve stack]' + }); + })); + + test('multiline stack trace', function (t) { + t.plan(1); + var err = new Error('Preserve stack'); + err.stack = stackTrace; + t.error(err); + }); }); tap.test('parses function info from original stack', function (tt) { - tt.plan(4); - - var test = tape.createHarness(); - test.createStream(); - - test._results._watch = function (t) { - t.on('result', function (res) { - tt.equal('Test.testFunctionNameParsing', res.functionName); - tt.match(res.file, /stackTrace.js/i); - tt.ok(Number(res.line) > 0); - tt.ok(Number(res.column) > 0); - }); - }; - - test('t.equal stack trace', function testFunctionNameParsing(t) { - t.equal(true, false, 'true should be false'); - t.end(); - }); + tt.plan(4); + + var test = tape.createHarness(); + test.createStream(); + + test._results._watch = function (t) { + t.on('result', function (res) { + tt.equal('Test.testFunctionNameParsing', res.functionName); + tt.match(res.file, /stackTrace.js/i); + tt.ok(Number(res.line) > 0); + tt.ok(Number(res.column) > 0); + }); + }; + + test('t.equal stack trace', function testFunctionNameParsing(t) { + t.equal(true, false, 'true should be false'); + t.end(); + }); }); tap.test('parses function info from original stack for anonymous function', function (tt) { - tt.plan(4); - - var test = tape.createHarness(); - test.createStream(); - - test._results._watch = function (t) { - t.on('result', function (res) { - tt.equal('Test.', res.functionName); - tt.match(res.file, /stackTrace.js/i); - tt.ok(Number(res.line) > 0); - tt.ok(Number(res.column) > 0); - }); - }; - - test('t.equal stack trace', function (t) { - t.equal(true, false, 'true should be false'); - t.end(); - }); + tt.plan(4); + + var test = tape.createHarness(); + test.createStream(); + + test._results._watch = function (t) { + t.on('result', function (res) { + tt.equal('Test.', res.functionName); + tt.match(res.file, /stackTrace.js/i); + tt.ok(Number(res.line) > 0); + tt.ok(Number(res.column) > 0); + }); + }; + + test('t.equal stack trace', function (t) { + t.equal(true, false, 'true should be false'); + t.end(); + }); }); if (typeof Promise === 'function' && typeof Promise.resolve === 'function') { - tap.test('parses function info from original stack for Promise scenario', function (tt) { - tt.plan(4); - - var test = tape.createHarness(); - test.createStream(); - - test._results._watch = function (t) { - t.on('result', function (res) { - tt.equal('onfulfilled', res.functionName); - tt.match(res.file, /stackTrace.js/i); - tt.ok(Number(res.line) > 0); - tt.ok(Number(res.column) > 0); - }); - }; - - test('t.equal stack trace', function testFunctionNameParsing(t) { - new Promise(function (resolve) { - resolve(); - }).then(function onfulfilled() { - t.equal(true, false, 'true should be false'); - t.end(); - }); - }); - }); - - tap.test('parses function info from original stack for Promise scenario with anonymous function', function (tt) { - tt.plan(4); - - var test = tape.createHarness(); - test.createStream(); - - test._results._watch = function (t) { - t.on('result', function (res) { - tt.equal('', res.functionName); - tt.match(res.file, /stackTrace.js/i); - tt.ok(Number(res.line) > 0); - tt.ok(Number(res.column) > 0); - }); - }; - - test('t.equal stack trace', function testFunctionNameParsing(t) { - new Promise(function (resolve) { - resolve(); - }).then(function () { - t.equal(true, false, 'true should be false'); - t.end(); - }); - }); - }); + tap.test('parses function info from original stack for Promise scenario', function (tt) { + tt.plan(4); + + var test = tape.createHarness(); + test.createStream(); + + test._results._watch = function (t) { + t.on('result', function (res) { + tt.equal('onfulfilled', res.functionName); + tt.match(res.file, /stackTrace.js/i); + tt.ok(Number(res.line) > 0); + tt.ok(Number(res.column) > 0); + }); + }; + + test('t.equal stack trace', function testFunctionNameParsing(t) { + new Promise(function (resolve) { + resolve(); + }).then(function onfulfilled() { + t.equal(true, false, 'true should be false'); + t.end(); + }); + }); + }); + + tap.test('parses function info from original stack for Promise scenario with anonymous function', function (tt) { + tt.plan(4); + + var test = tape.createHarness(); + test.createStream(); + + test._results._watch = function (t) { + t.on('result', function (res) { + tt.equal('', res.functionName); + tt.match(res.file, /stackTrace.js/i); + tt.ok(Number(res.line) > 0); + tt.ok(Number(res.column) > 0); + }); + }; + + test('t.equal stack trace', function testFunctionNameParsing(t) { + new Promise(function (resolve) { + resolve(); + }).then(function () { + t.equal(true, false, 'true should be false'); + t.end(); + }); + }); + }); } tap.test('preserves stack trace for failed assertions', function (tt) { - tt.plan(6); - - var test = tape.createHarness(); - var stream = test.createStream(); - var parser = stream.pipe(tapParser()); - - var stack = ''; - parser.once('assert', function (data) { - tt.equal(typeof data.diag.at, 'string'); - tt.equal(typeof data.diag.stack, 'string'); - var at = data.diag.at || ''; - stack = data.diag.stack || ''; - tt.ok((/^Error: true should be false(\n {4}at .+)+/).exec(stack), 'stack should be a stack'); - tt.deepEqual(data, { - ok: false, - id: 1, - name: 'true should be false', - diag: { - at: at, - stack: stack, - operator: 'equal', - expected: false, - actual: true - } - }); - }); - - stream.pipe(concat(function (body) { - var strippedBody = stripAt(body.toString('utf8')); - tt.equal( - strippedBody, - 'TAP version 13\n' + tt.plan(6); + + var test = tape.createHarness(); + var stream = test.createStream(); + var parser = stream.pipe(tapParser()); + + var stack = ''; + parser.once('assert', function (data) { + tt.equal(typeof data.diag.at, 'string'); + tt.equal(typeof data.diag.stack, 'string'); + var at = data.diag.at || ''; + stack = data.diag.stack || ''; + tt.ok((/^Error: true should be false(\n {4}at .+)+/).exec(stack), 'stack should be a stack'); + tt.deepEqual(data, { + ok: false, + id: 1, + name: 'true should be false', + diag: { + at: at, + stack: stack, + operator: 'equal', + expected: false, + actual: true + } + }); + }); + + stream.pipe(concat(function (body) { + var strippedBody = stripAt(body.toString('utf8')); + tt.equal( + strippedBody, + 'TAP version 13\n' + '# t.equal stack trace\n' + 'not ok 1 true should be false\n' + ' ---\n' @@ -214,55 +214,55 @@ tap.test('preserves stack trace for failed assertions', function (tt) { + '# tests 1\n' + '# pass 0\n' + '# fail 1\n' - ); - - tt.deepEqual(getDiag(strippedBody), { - stack: stack, - operator: 'equal', - expected: false, - actual: true - }); - })); - - test('t.equal stack trace', function (t) { - t.plan(1); - t.equal(true, false, 'true should be false'); - }); + ); + + tt.deepEqual(getDiag(strippedBody), { + stack: stack, + operator: 'equal', + expected: false, + actual: true + }); + })); + + test('t.equal stack trace', function (t) { + t.plan(1); + t.equal(true, false, 'true should be false'); + }); }); tap.test('preserves stack trace for failed assertions where actual===falsy', function (tt) { - tt.plan(6); - - var test = tape.createHarness(); - var stream = test.createStream(); - var parser = stream.pipe(tapParser()); - - var stack = ''; - parser.once('assert', function (data) { - tt.equal(typeof data.diag.at, 'string'); - tt.equal(typeof data.diag.stack, 'string'); - var at = data.diag.at || ''; - stack = data.diag.stack || ''; - tt.ok((/^Error: false should be true(\n {4}at .+)+/).exec(stack), 'stack should be a stack'); - tt.deepEqual(data, { - ok: false, - id: 1, - name: 'false should be true', - diag: { - at: at, - stack: stack, - operator: 'equal', - expected: true, - actual: false - } - }); - }); - - stream.pipe(concat(function (body) { - var strippedBody = stripAt(body.toString('utf8')); - tt.equal( - strippedBody, - 'TAP version 13\n' + tt.plan(6); + + var test = tape.createHarness(); + var stream = test.createStream(); + var parser = stream.pipe(tapParser()); + + var stack = ''; + parser.once('assert', function (data) { + tt.equal(typeof data.diag.at, 'string'); + tt.equal(typeof data.diag.stack, 'string'); + var at = data.diag.at || ''; + stack = data.diag.stack || ''; + tt.ok((/^Error: false should be true(\n {4}at .+)+/).exec(stack), 'stack should be a stack'); + tt.deepEqual(data, { + ok: false, + id: 1, + name: 'false should be true', + diag: { + at: at, + stack: stack, + operator: 'equal', + expected: true, + actual: false + } + }); + }); + + stream.pipe(concat(function (body) { + var strippedBody = stripAt(body.toString('utf8')); + tt.equal( + strippedBody, + 'TAP version 13\n' + '# t.equal stack trace\n' + 'not ok 1 false should be true\n' + ' ---\n' @@ -279,36 +279,36 @@ tap.test('preserves stack trace for failed assertions where actual===falsy', fun + '# tests 1\n' + '# pass 0\n' + '# fail 1\n' - ); - - tt.deepEqual(getDiag(strippedBody), { - stack: stack, - operator: 'equal', - expected: true, - actual: false - }); - })); - - test('t.equal stack trace', function (t) { - t.plan(1); - t.equal(false, true, 'false should be true'); - }); + ); + + tt.deepEqual(getDiag(strippedBody), { + stack: stack, + operator: 'equal', + expected: true, + actual: false + }); + })); + + test('t.equal stack trace', function (t) { + t.plan(1); + t.equal(false, true, 'false should be true'); + }); }); function getDiag(body) { - var yamlStart = body.indexOf(' ---'); - var yamlEnd = body.indexOf(' ...\n'); - var diag = body.slice(yamlStart, yamlEnd).split('\n').map(function (line) { - return line.slice(2); - }).join('\n'); - - // Get rid of 'at' variable (which has a line number / path of its own that's - // difficult to check). - var withStack = yaml.safeLoad(diag); - delete withStack.at; - return withStack; + var yamlStart = body.indexOf(' ---'); + var yamlEnd = body.indexOf(' ...\n'); + var diag = body.slice(yamlStart, yamlEnd).split('\n').map(function (line) { + return line.slice(2); + }).join('\n'); + + // Get rid of 'at' variable (which has a line number / path of its own that's + // difficult to check). + var withStack = yaml.safeLoad(diag); + delete withStack.at; + return withStack; } function stripAt(body) { - return body.replace(/^\s*at:\s+Test.*$\n/m, ''); + return body.replace(/^\s*at:\s+Test.*$\n/m, ''); } diff --git a/test/subcount.js b/test/subcount.js index 62b94746..c670b460 100644 --- a/test/subcount.js +++ b/test/subcount.js @@ -3,14 +3,14 @@ var test = require('../'); test('parent test', function (t) { - t.plan(2); - t.test('first child', function (st) { - st.plan(1); - st.pass('pass first child'); - }); + t.plan(2); + t.test('first child', function (st) { + st.plan(1); + st.pass('pass first child'); + }); - t.test(function (st) { - st.plan(1); - st.pass('pass second child'); - }); + t.test(function (st) { + st.plan(1); + st.pass('pass second child'); + }); }); diff --git a/test/subtest_and_async.js b/test/subtest_and_async.js index a5843e53..6f26a689 100644 --- a/test/subtest_and_async.js +++ b/test/subtest_and_async.js @@ -3,25 +3,25 @@ var test = require('../'); var asyncFunction = function (callback) { - setTimeout(callback, Math.random * 50); + setTimeout(callback, Math.random * 50); }; test('master test', function (t) { - t.test('subtest 1', function (st) { - st.pass('subtest 1 before async call'); - asyncFunction(function () { - st.pass('subtest 1 in async callback'); - st.end(); - }); - }); + t.test('subtest 1', function (st) { + st.pass('subtest 1 before async call'); + asyncFunction(function () { + st.pass('subtest 1 in async callback'); + st.end(); + }); + }); - t.test('subtest 2', function (st) { - st.pass('subtest 2 before async call'); - asyncFunction(function () { - st.pass('subtest 2 in async callback'); - st.end(); - }); - }); + t.test('subtest 2', function (st) { + st.pass('subtest 2 before async call'); + asyncFunction(function () { + st.pass('subtest 2 in async callback'); + st.end(); + }); + }); - t.end(); + t.end(); }); diff --git a/test/subtest_plan.js b/test/subtest_plan.js index b3063b96..04c2dad3 100644 --- a/test/subtest_plan.js +++ b/test/subtest_plan.js @@ -3,21 +3,21 @@ var test = require('../'); test('parent', function (t) { - t.plan(3); + t.plan(3); - var firstChildRan = false; + var firstChildRan = false; - t.pass('assertion in parent'); + t.pass('assertion in parent'); - t.test('first child', function (st) { - st.plan(1); - st.pass('pass first child'); - firstChildRan = true; - }); + t.test('first child', function (st) { + st.plan(1); + st.pass('pass first child'); + firstChildRan = true; + }); - t.test('second child', function (st) { - st.plan(2); - st.ok(firstChildRan, 'first child ran first'); - st.pass('pass second child'); - }); + t.test('second child', function (st) { + st.plan(2); + st.ok(firstChildRan, 'first child ran first'); + st.pass('pass second child'); + }); }); diff --git a/test/teardown.js b/test/teardown.js index f804f8c6..34c69c30 100644 --- a/test/teardown.js +++ b/test/teardown.js @@ -11,259 +11,259 @@ var flatMap = require('array.prototype.flatmap'); var stripFullStack = require('./common').stripFullStack; tap.test('teardowns', function (tt) { - tt.plan(1); + tt.plan(1); - var test = tape.createHarness(); - test.createStream().pipe(concat(function (body) { - tt.same(stripFullStack(body.toString('utf8')), [].concat( - 'TAP version 13', - '# success', - 'ok 1 should be truthy', - '# success teardown', - '# success teardown 2', - '# success (async)', - 'ok 2 should be truthy', - '# success (async) teardown', - '# success (async) teardown 2', - '# nested teardowns', - '# nested success', - 'ok 3 should be truthy', - '# nested teardown (nested success level)', - '# nested teardown (nested success level) 2', - '# nested failure', - 'not ok 4 nested failure!', - ' ---', - ' operator: fail', - ' at: Test. ($TEST/teardown.js:$LINE:$COL)', - ' stack: |-', - ' Error: nested failure!', - ' [... stack stripped ...]', - ' at Test. ($TEST/teardown.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - '# nested teardown (nested fail level)', - '# nested teardown (nested fail level) 2', - '# nested teardown (top level)', - '# nested teardown (top level) 2', - '# fail', - 'not ok 5 failure!', - ' ---', - ' operator: fail', - ' at: Test. ($TEST/teardown.js:$LINE:$COL)', - ' stack: |-', - ' Error: failure!', - ' [... stack stripped ...]', - ' at Test. ($TEST/teardown.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - '# failure teardown', - '# failure teardown 2', - '# teardown errors do not stop the next teardown fn from running', - 'ok 6 should be truthy', - 'not ok 7 SyntaxError: teardown error!', - ' ---', - ' operator: fail', - ' stack: |-', - ' Error: SyntaxError: teardown error!', - ' [... stack stripped ...]', - ' ...', - 'not ok 8 plan != count', - ' ---', - ' operator: fail', - ' expected: 1', - ' actual: 2', - ' stack: |-', - ' Error: plan != count', - ' [... stack stripped ...]', - ' ...', - '# teardown runs after teardown error', - '# teardown given non-function fails the test', - 'ok 9 should be truthy', - flatMap(v.nonFunctions, function (nonFunction, i) { - var offset = 10; - return [].concat( - 'not ok ' + (offset + (i > 0 ? i + 1 : i)) + ' teardown: ' + inspect(nonFunction) + ' is not a function', - ' ---', - ' operator: fail', - ' at: ($TEST/teardown.js:$LINE:$COL)', - ' stack: |-', - ' Error: teardown: ' + inspect(nonFunction) + ' is not a function', - ' [... stack stripped ...]', - ' at $TEST/teardown.js:$LINE:$COL', - ' [... stack stripped ...]', - ' at Test. ($TEST/teardown.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - i > 0 ? [] : [ - 'not ok ' + (offset + 1) + ' plan != count', - ' ---', - ' operator: fail', - ' expected: 1', - ' actual: 2', - ' at: ($TEST/teardown.js:$LINE:$COL)', - ' stack: |-', - ' Error: plan != count', - ' [... stack stripped ...]', - ' at $TEST/teardown.js:$LINE:$COL', - ' [... stack stripped ...]', - ' at Test. ($TEST/teardown.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...' - ] - ); - }), - typeof Promise === 'function' ? [ - '# success (promise)', - 'ok ' + (11 + v.nonFunctions.length) + ' should be truthy', - '# success (promise) teardown: 1', - '# success (promise) teardown: 2', - '# success (promise) teardown: 3' - ] : [ - '# SKIP success (promise)' - ], - [ - '', - '1..' + ((typeof Promise === 'function' ? 1 : 0) + 10 + v.nonFunctions.length), - '# tests ' + ((typeof Promise === 'function' ? 1 : 0) + 10 + v.nonFunctions.length), - '# pass ' + ((typeof Promise === 'function' ? 1 : 0) + 5), - '# fail ' + (5 + v.nonFunctions.length), - '' - ] - )); - })); + var test = tape.createHarness(); + test.createStream().pipe(concat(function (body) { + tt.same(stripFullStack(body.toString('utf8')), [].concat( + 'TAP version 13', + '# success', + 'ok 1 should be truthy', + '# success teardown', + '# success teardown 2', + '# success (async)', + 'ok 2 should be truthy', + '# success (async) teardown', + '# success (async) teardown 2', + '# nested teardowns', + '# nested success', + 'ok 3 should be truthy', + '# nested teardown (nested success level)', + '# nested teardown (nested success level) 2', + '# nested failure', + 'not ok 4 nested failure!', + ' ---', + ' operator: fail', + ' at: Test. ($TEST/teardown.js:$LINE:$COL)', + ' stack: |-', + ' Error: nested failure!', + ' [... stack stripped ...]', + ' at Test. ($TEST/teardown.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + '# nested teardown (nested fail level)', + '# nested teardown (nested fail level) 2', + '# nested teardown (top level)', + '# nested teardown (top level) 2', + '# fail', + 'not ok 5 failure!', + ' ---', + ' operator: fail', + ' at: Test. ($TEST/teardown.js:$LINE:$COL)', + ' stack: |-', + ' Error: failure!', + ' [... stack stripped ...]', + ' at Test. ($TEST/teardown.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + '# failure teardown', + '# failure teardown 2', + '# teardown errors do not stop the next teardown fn from running', + 'ok 6 should be truthy', + 'not ok 7 SyntaxError: teardown error!', + ' ---', + ' operator: fail', + ' stack: |-', + ' Error: SyntaxError: teardown error!', + ' [... stack stripped ...]', + ' ...', + 'not ok 8 plan != count', + ' ---', + ' operator: fail', + ' expected: 1', + ' actual: 2', + ' stack: |-', + ' Error: plan != count', + ' [... stack stripped ...]', + ' ...', + '# teardown runs after teardown error', + '# teardown given non-function fails the test', + 'ok 9 should be truthy', + flatMap(v.nonFunctions, function (nonFunction, i) { + var offset = 10; + return [].concat( + 'not ok ' + (offset + (i > 0 ? i + 1 : i)) + ' teardown: ' + inspect(nonFunction) + ' is not a function', + ' ---', + ' operator: fail', + ' at: ($TEST/teardown.js:$LINE:$COL)', + ' stack: |-', + ' Error: teardown: ' + inspect(nonFunction) + ' is not a function', + ' [... stack stripped ...]', + ' at $TEST/teardown.js:$LINE:$COL', + ' [... stack stripped ...]', + ' at Test. ($TEST/teardown.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + i > 0 ? [] : [ + 'not ok ' + (offset + 1) + ' plan != count', + ' ---', + ' operator: fail', + ' expected: 1', + ' actual: 2', + ' at: ($TEST/teardown.js:$LINE:$COL)', + ' stack: |-', + ' Error: plan != count', + ' [... stack stripped ...]', + ' at $TEST/teardown.js:$LINE:$COL', + ' [... stack stripped ...]', + ' at Test. ($TEST/teardown.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...' + ] + ); + }), + typeof Promise === 'function' ? [ + '# success (promise)', + 'ok ' + (11 + v.nonFunctions.length) + ' should be truthy', + '# success (promise) teardown: 1', + '# success (promise) teardown: 2', + '# success (promise) teardown: 3' + ] : [ + '# SKIP success (promise)' + ], + [ + '', + '1..' + ((typeof Promise === 'function' ? 1 : 0) + 10 + v.nonFunctions.length), + '# tests ' + ((typeof Promise === 'function' ? 1 : 0) + 10 + v.nonFunctions.length), + '# pass ' + ((typeof Promise === 'function' ? 1 : 0) + 5), + '# fail ' + (5 + v.nonFunctions.length), + '' + ] + )); + })); - test('success', function (t) { - t.plan(1); - t.teardown(function () { - t.comment('success teardown'); - }); - t.teardown(function () { - t.comment('success teardown 2'); - }); - t.ok('success!'); - }); + test('success', function (t) { + t.plan(1); + t.teardown(function () { + t.comment('success teardown'); + }); + t.teardown(function () { + t.comment('success teardown 2'); + }); + t.ok('success!'); + }); - test('success (async)', function (t) { - t.plan(1); - t.teardown(function () { - t.comment('success (async) teardown'); - }); - t.teardown(function () { - t.comment('success (async) teardown 2'); - }); - setTimeout(function () { - t.ok('success!'); - }, 10); - }); + test('success (async)', function (t) { + t.plan(1); + t.teardown(function () { + t.comment('success (async) teardown'); + }); + t.teardown(function () { + t.comment('success (async) teardown 2'); + }); + setTimeout(function () { + t.ok('success!'); + }, 10); + }); - test('nested teardowns', function (t) { - t.plan(2); + test('nested teardowns', function (t) { + t.plan(2); - t.teardown(function () { - t.comment('nested teardown (top level)'); - }); - t.teardown(function () { - t.comment('nested teardown (top level) 2'); - }); + t.teardown(function () { + t.comment('nested teardown (top level)'); + }); + t.teardown(function () { + t.comment('nested teardown (top level) 2'); + }); - t.test('nested success', function (st) { - st.teardown(function () { - st.comment('nested teardown (nested success level)'); - }); - st.teardown(function () { - st.comment('nested teardown (nested success level) 2'); - }); + t.test('nested success', function (st) { + st.teardown(function () { + st.comment('nested teardown (nested success level)'); + }); + st.teardown(function () { + st.comment('nested teardown (nested success level) 2'); + }); - st.ok('nested success!'); - st.end(); - }); + st.ok('nested success!'); + st.end(); + }); - t.test('nested failure', function (st) { - st.plan(1); + t.test('nested failure', function (st) { + st.plan(1); - st.teardown(function () { - st.comment('nested teardown (nested fail level)'); - }); - st.teardown(function () { - st.comment('nested teardown (nested fail level) 2'); - }); + st.teardown(function () { + st.comment('nested teardown (nested fail level)'); + }); + st.teardown(function () { + st.comment('nested teardown (nested fail level) 2'); + }); - st.fail('nested failure!'); - }); - }); + st.fail('nested failure!'); + }); + }); - test('fail', function (t) { - t.plan(1); + test('fail', function (t) { + t.plan(1); - t.teardown(function () { - t.comment('failure teardown'); - }); - t.teardown(function () { - t.comment('failure teardown 2'); - }); + t.teardown(function () { + t.comment('failure teardown'); + }); + t.teardown(function () { + t.comment('failure teardown 2'); + }); - t.fail('failure!'); - }); + t.fail('failure!'); + }); - test('teardown errors do not stop the next teardown fn from running', function (t) { - t.plan(1); + test('teardown errors do not stop the next teardown fn from running', function (t) { + t.plan(1); - t.ok('teardown error test'); + t.ok('teardown error test'); - t.teardown(function () { - throw new SyntaxError('teardown error!'); - }); - t.teardown(function () { - t.comment('teardown runs after teardown error'); - }); - }); + t.teardown(function () { + throw new SyntaxError('teardown error!'); + }); + t.teardown(function () { + t.comment('teardown runs after teardown error'); + }); + }); - test('teardown given non-function fails the test', function (t) { - t.plan(1); + test('teardown given non-function fails the test', function (t) { + t.plan(1); - t.ok('non-function test'); + t.ok('non-function test'); - forEach(v.nonFunctions, function (nonFunction) { - t.teardown(nonFunction); - }); - }); + forEach(v.nonFunctions, function (nonFunction) { + t.teardown(nonFunction); + }); + }); - test('success (promise)', { skip: typeof Promise !== 'function' }, function (t) { - t.plan(1); + test('success (promise)', { skip: typeof Promise !== 'function' }, function (t) { + t.plan(1); - t.teardown(function () { - return new Promise(function (resolve) { - t.comment('success (promise) teardown: 1'); - setTimeout(resolve, 10); - }).then(function () { - t.comment('success (promise) teardown: 2'); - }); - }); - t.teardown(function () { - t.comment('success (promise) teardown: 3'); - }); + t.teardown(function () { + return new Promise(function (resolve) { + t.comment('success (promise) teardown: 1'); + setTimeout(resolve, 10); + }).then(function () { + t.comment('success (promise) teardown: 2'); + }); + }); + t.teardown(function () { + t.comment('success (promise) teardown: 3'); + }); - setTimeout(function () { - t.ok('success!'); - }, 10); - }); + setTimeout(function () { + t.ok('success!'); + }, 10); + }); }); tap.test('teardown with promise', { skip: typeof Promise !== 'function', timeout: 1e3 }, function (tt) { - tt.plan(2); - tape('dummy test', function (t) { - var resolved = false; - t.teardown(function () { - tt.pass('tape teardown'); - var p = Promise.resolve(); - p.then(function () { - resolved = true; - }); - return p; - }); - t.on('end', function () { - tt.is(resolved, true); - }); - t.end(); - }); + tt.plan(2); + tape('dummy test', function (t) { + var resolved = false; + t.teardown(function () { + tt.pass('tape teardown'); + var p = Promise.resolve(); + p.then(function () { + resolved = true; + }); + return p; + }); + t.on('end', function () { + tt.is(resolved, true); + }); + t.end(); + }); }); diff --git a/test/throws.js b/test/throws.js index a683bfcf..9186d052 100644 --- a/test/throws.js +++ b/test/throws.js @@ -7,218 +7,218 @@ var concat = require('concat-stream'); var stripFullStack = require('./common').stripFullStack; function getNonFunctionMessage(fn) { - try { - fn(); - } catch (e) { - return e.message; - } - return ''; + try { + fn(); + } catch (e) { + return e.message; + } + return ''; } var getter = function () { return 'message'; }; var messageGetterError = Object.defineProperty( - { custom: 'error' }, - 'message', - { configurable: true, enumerable: true, get: getter } + { custom: 'error' }, + 'message', + { configurable: true, enumerable: true, get: getter } ); var thrower = function () { throw messageGetterError; }; tap.test('failures', function (tt) { - tt.plan(1); + tt.plan(1); - var test = tape.createHarness(); - test.createStream().pipe(concat(function (body) { - tt.same(stripFullStack(body.toString('utf8')), [ - 'TAP version 13', - '# non functions', - 'not ok 1 should throw', - ' ---', - ' operator: throws', - ' expected: |-', - ' undefined', - ' actual: |-', - ' { [TypeError: ' + getNonFunctionMessage() + "] message: '" + getNonFunctionMessage() + "' }", - ' at: Test. ($TEST/throws.js:$LINE:$COL)', - ' stack: |-', - String(' TypeError: ' + getNonFunctionMessage(undefined)), - ' [... stack stripped ...]', - ' at Test. ($TEST/throws.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 2 should throw', - ' ---', - ' operator: throws', - ' expected: |-', - ' undefined', - ' actual: |-', - ' { [TypeError: ' + getNonFunctionMessage(null) + "] message: '" + getNonFunctionMessage(null) + "' }", - ' at: Test. ($TEST/throws.js:$LINE:$COL)', - ' stack: |-', - String(' TypeError: ' + getNonFunctionMessage(null)), - ' [... stack stripped ...]', - ' at Test. ($TEST/throws.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 3 should throw', - ' ---', - ' operator: throws', - ' expected: |-', - ' undefined', - ' actual: |-', - ' { [TypeError: ' + getNonFunctionMessage(true) + "] message: '" + getNonFunctionMessage(true) + "' }", - ' at: Test. ($TEST/throws.js:$LINE:$COL)', - ' stack: |-', - String(' TypeError: ' + getNonFunctionMessage(true)), - ' [... stack stripped ...]', - ' at Test. ($TEST/throws.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 4 should throw', - ' ---', - ' operator: throws', - ' expected: |-', - ' undefined', - ' actual: |-', - ' { [TypeError: ' + getNonFunctionMessage(false) + "] message: '" + getNonFunctionMessage(false) + "' }", - ' at: Test. ($TEST/throws.js:$LINE:$COL)', - ' stack: |-', - String(' TypeError: ' + getNonFunctionMessage(false)), - ' [... stack stripped ...]', - ' at Test. ($TEST/throws.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 5 should throw', - ' ---', - ' operator: throws', - ' expected: |-', - ' undefined', - ' actual: |-', - ' { [TypeError: ' + getNonFunctionMessage('abc') + "] message: '" + getNonFunctionMessage('abc') + "' }", - ' at: Test. ($TEST/throws.js:$LINE:$COL)', - ' stack: |-', - String(' TypeError: ' + getNonFunctionMessage('abc')), - ' [... stack stripped ...]', - ' at Test. ($TEST/throws.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 6 should throw', - ' ---', - ' operator: throws', - ' expected: |-', - ' undefined', - ' actual: |-', - ' { [TypeError: ' + getNonFunctionMessage(/a/g) + "] message: '" + getNonFunctionMessage(/a/g) + "' }", - ' at: Test. ($TEST/throws.js:$LINE:$COL)', - ' stack: |-', - String(' TypeError: ' + getNonFunctionMessage(/a/g)), - ' [... stack stripped ...]', - ' at Test. ($TEST/throws.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 7 should throw', - ' ---', - ' operator: throws', - ' expected: |-', - ' undefined', - ' actual: |-', - ' { [TypeError: ' + getNonFunctionMessage([]) + "] message: '" + getNonFunctionMessage([]) + "' }", - ' at: Test. ($TEST/throws.js:$LINE:$COL)', - ' stack: |-', - String(' TypeError: ' + getNonFunctionMessage([])), - ' [... stack stripped ...]', - ' at Test. ($TEST/throws.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'not ok 8 should throw', - ' ---', - ' operator: throws', - ' expected: |-', - ' undefined', - ' actual: |-', - ' { [TypeError: ' + getNonFunctionMessage({}) + "] message: '" + getNonFunctionMessage({}) + "' }", - ' at: Test. ($TEST/throws.js:$LINE:$COL)', - ' stack: |-', - String(' TypeError: ' + getNonFunctionMessage({})), - ' [... stack stripped ...]', - ' at Test. ($TEST/throws.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - '# function', - 'not ok 9 should throw', - ' ---', - ' operator: throws', - ' expected: undefined', - ' actual: undefined', - ' at: Test. ($TEST/throws.js:$LINE:$COL)', - ' stack: |-', - ' Error: should throw', - ' [... stack stripped ...]', - ' at Test. ($TEST/throws.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - '# custom error messages', - 'ok 10 "message" is enumerable', - "ok 11 { custom: 'error', message: 'message' }", - 'ok 12 getter is still the same', - '# throws null', - 'ok 13 throws null', - '# wrong type of error', - 'not ok 14 throws actual', - ' ---', - ' operator: throws', - ' expected: |-', - ' [Function: TypeError]', - ' actual: |-', - " { [RangeError: actual!] message: 'actual!' }", - ' at: Test. ($TEST/throws.js:$LINE:$COL)', - ' stack: |-', - ' RangeError: actual!', - ' at Test. ($TEST/throws.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - '', - '1..14', - '# tests 14', - '# pass 4', - '# fail 10', - '' - ]); - })); + var test = tape.createHarness(); + test.createStream().pipe(concat(function (body) { + tt.same(stripFullStack(body.toString('utf8')), [ + 'TAP version 13', + '# non functions', + 'not ok 1 should throw', + ' ---', + ' operator: throws', + ' expected: |-', + ' undefined', + ' actual: |-', + ' { [TypeError: ' + getNonFunctionMessage() + "] message: '" + getNonFunctionMessage() + "' }", + ' at: Test. ($TEST/throws.js:$LINE:$COL)', + ' stack: |-', + String(' TypeError: ' + getNonFunctionMessage(undefined)), + ' [... stack stripped ...]', + ' at Test. ($TEST/throws.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 2 should throw', + ' ---', + ' operator: throws', + ' expected: |-', + ' undefined', + ' actual: |-', + ' { [TypeError: ' + getNonFunctionMessage(null) + "] message: '" + getNonFunctionMessage(null) + "' }", + ' at: Test. ($TEST/throws.js:$LINE:$COL)', + ' stack: |-', + String(' TypeError: ' + getNonFunctionMessage(null)), + ' [... stack stripped ...]', + ' at Test. ($TEST/throws.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 3 should throw', + ' ---', + ' operator: throws', + ' expected: |-', + ' undefined', + ' actual: |-', + ' { [TypeError: ' + getNonFunctionMessage(true) + "] message: '" + getNonFunctionMessage(true) + "' }", + ' at: Test. ($TEST/throws.js:$LINE:$COL)', + ' stack: |-', + String(' TypeError: ' + getNonFunctionMessage(true)), + ' [... stack stripped ...]', + ' at Test. ($TEST/throws.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 4 should throw', + ' ---', + ' operator: throws', + ' expected: |-', + ' undefined', + ' actual: |-', + ' { [TypeError: ' + getNonFunctionMessage(false) + "] message: '" + getNonFunctionMessage(false) + "' }", + ' at: Test. ($TEST/throws.js:$LINE:$COL)', + ' stack: |-', + String(' TypeError: ' + getNonFunctionMessage(false)), + ' [... stack stripped ...]', + ' at Test. ($TEST/throws.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 5 should throw', + ' ---', + ' operator: throws', + ' expected: |-', + ' undefined', + ' actual: |-', + ' { [TypeError: ' + getNonFunctionMessage('abc') + "] message: '" + getNonFunctionMessage('abc') + "' }", + ' at: Test. ($TEST/throws.js:$LINE:$COL)', + ' stack: |-', + String(' TypeError: ' + getNonFunctionMessage('abc')), + ' [... stack stripped ...]', + ' at Test. ($TEST/throws.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 6 should throw', + ' ---', + ' operator: throws', + ' expected: |-', + ' undefined', + ' actual: |-', + ' { [TypeError: ' + getNonFunctionMessage(/a/g) + "] message: '" + getNonFunctionMessage(/a/g) + "' }", + ' at: Test. ($TEST/throws.js:$LINE:$COL)', + ' stack: |-', + String(' TypeError: ' + getNonFunctionMessage(/a/g)), + ' [... stack stripped ...]', + ' at Test. ($TEST/throws.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 7 should throw', + ' ---', + ' operator: throws', + ' expected: |-', + ' undefined', + ' actual: |-', + ' { [TypeError: ' + getNonFunctionMessage([]) + "] message: '" + getNonFunctionMessage([]) + "' }", + ' at: Test. ($TEST/throws.js:$LINE:$COL)', + ' stack: |-', + String(' TypeError: ' + getNonFunctionMessage([])), + ' [... stack stripped ...]', + ' at Test. ($TEST/throws.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'not ok 8 should throw', + ' ---', + ' operator: throws', + ' expected: |-', + ' undefined', + ' actual: |-', + ' { [TypeError: ' + getNonFunctionMessage({}) + "] message: '" + getNonFunctionMessage({}) + "' }", + ' at: Test. ($TEST/throws.js:$LINE:$COL)', + ' stack: |-', + String(' TypeError: ' + getNonFunctionMessage({})), + ' [... stack stripped ...]', + ' at Test. ($TEST/throws.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + '# function', + 'not ok 9 should throw', + ' ---', + ' operator: throws', + ' expected: undefined', + ' actual: undefined', + ' at: Test. ($TEST/throws.js:$LINE:$COL)', + ' stack: |-', + ' Error: should throw', + ' [... stack stripped ...]', + ' at Test. ($TEST/throws.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + '# custom error messages', + 'ok 10 "message" is enumerable', + "ok 11 { custom: 'error', message: 'message' }", + 'ok 12 getter is still the same', + '# throws null', + 'ok 13 throws null', + '# wrong type of error', + 'not ok 14 throws actual', + ' ---', + ' operator: throws', + ' expected: |-', + ' [Function: TypeError]', + ' actual: |-', + " { [RangeError: actual!] message: 'actual!' }", + ' at: Test. ($TEST/throws.js:$LINE:$COL)', + ' stack: |-', + ' RangeError: actual!', + ' at Test. ($TEST/throws.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + '', + '1..14', + '# tests 14', + '# pass 4', + '# fail 10', + '' + ]); + })); - test('non functions', function (t) { - t.plan(8); - t['throws'](); - t['throws'](null); - t['throws'](true); - t['throws'](false); - t['throws']('abc'); - t['throws'](/a/g); - t['throws']([]); - t['throws']({}); - }); + test('non functions', function (t) { + t.plan(8); + t['throws'](); + t['throws'](null); + t['throws'](true); + t['throws'](false); + t['throws']('abc'); + t['throws'](/a/g); + t['throws']([]); + t['throws']({}); + }); - test('function', function (t) { - t.plan(1); - t['throws'](function () {}); - }); + test('function', function (t) { + t.plan(1); + t['throws'](function () {}); + }); - test('custom error messages', function (t) { - t.plan(3); - t.equal(Object.prototype.propertyIsEnumerable.call(messageGetterError, 'message'), true, '"message" is enumerable'); - t['throws'](thrower, "{ custom: 'error', message: 'message' }"); - t.equal(Object.getOwnPropertyDescriptor(messageGetterError, 'message').get, getter, 'getter is still the same'); - }); + test('custom error messages', function (t) { + t.plan(3); + t.equal(Object.prototype.propertyIsEnumerable.call(messageGetterError, 'message'), true, '"message" is enumerable'); + t['throws'](thrower, "{ custom: 'error', message: 'message' }"); + t.equal(Object.getOwnPropertyDescriptor(messageGetterError, 'message').get, getter, 'getter is still the same'); + }); - test('throws null', function (t) { - t.plan(1); - t['throws'](function () { throw null; }, 'throws null'); - t.end(); - }); + test('throws null', function (t) { + t.plan(1); + t['throws'](function () { throw null; }, 'throws null'); + t.end(); + }); - test('wrong type of error', function (t) { - t.plan(1); - var actual = new RangeError('actual!'); - t['throws'](function () { throw actual; }, TypeError, 'throws actual'); - t.end(); - }); + test('wrong type of error', function (t) { + t.plan(1); + var actual = new RangeError('actual!'); + t['throws'](function () { throw actual; }, TypeError, 'throws actual'); + t.end(); + }); }); diff --git a/test/timeout.js b/test/timeout.js index bf11242d..27979678 100644 --- a/test/timeout.js +++ b/test/timeout.js @@ -4,14 +4,14 @@ var test = require('../'); var ran = 0; test('timeout', function (t) { - t.pass('this should run'); - ran++; - setTimeout(function () { - t.end(); - }, 100); + t.pass('this should run'); + ran++; + setTimeout(function () { + t.end(); + }, 100); }); test('should still run', { timeout: 50 }, function (t) { - t.equal(ran, 1); - t.end(); + t.equal(ran, 1); + t.end(); }); diff --git a/test/timeoutAfter.js b/test/timeoutAfter.js index 10a0fe4d..b81079b4 100644 --- a/test/timeoutAfter.js +++ b/test/timeoutAfter.js @@ -7,33 +7,33 @@ var concat = require('concat-stream'); var stripFullStack = require('./common').stripFullStack; tap.test('timeoutAfter test', function (tt) { - tt.plan(1); + tt.plan(1); - var test = tape.createHarness(); - var tc = function (rows) { - tt.same(stripFullStack(rows.toString('utf8')), [ - 'TAP version 13', - '# timeoutAfter', - 'not ok 1 timeoutAfter timed out after 1ms', - ' ---', - ' operator: fail', - ' stack: |-', - ' Error: timeoutAfter timed out after 1ms', - ' [... stack stripped ...]', - ' ...', - '', - '1..1', - '# tests 1', - '# pass 0', - '# fail 1', - '' - ]); - }; + var test = tape.createHarness(); + var tc = function (rows) { + tt.same(stripFullStack(rows.toString('utf8')), [ + 'TAP version 13', + '# timeoutAfter', + 'not ok 1 timeoutAfter timed out after 1ms', + ' ---', + ' operator: fail', + ' stack: |-', + ' Error: timeoutAfter timed out after 1ms', + ' [... stack stripped ...]', + ' ...', + '', + '1..1', + '# tests 1', + '# pass 0', + '# fail 1', + '' + ]); + }; - test.createStream().pipe(concat(tc)); + test.createStream().pipe(concat(tc)); - test('timeoutAfter', function (t) { - t.plan(1); - t.timeoutAfter(1); - }); + test('timeoutAfter', function (t) { + t.plan(1); + t.timeoutAfter(1); + }); }); diff --git a/test/todo.js b/test/todo.js index fe25481a..8c211c3c 100644 --- a/test/todo.js +++ b/test/todo.js @@ -8,37 +8,37 @@ var common = require('./common'); var stripFullStack = common.stripFullStack; tap.test('tape todo test', function (assert) { - var test = tape.createHarness({ exit: false }); - assert.plan(1); + var test = tape.createHarness({ exit: false }); + assert.plan(1); - test.createStream().pipe(concat(function (body) { - assert.same(stripFullStack(body.toString('utf8')), [ - 'TAP version 13', - '# success', - 'ok 1 this test runs', - '# TODO failure', - 'not ok 2 should never happen # TODO', - ' ---', - ' operator: fail', - ' at: Test. ($TEST/todo.js:$LINE:$COL)', - ' ...', - '', - '1..2', - '# tests 2', - '# pass 2', - '', - '# ok', - '' - ]); - })); + test.createStream().pipe(concat(function (body) { + assert.same(stripFullStack(body.toString('utf8')), [ + 'TAP version 13', + '# success', + 'ok 1 this test runs', + '# TODO failure', + 'not ok 2 should never happen # TODO', + ' ---', + ' operator: fail', + ' at: Test. ($TEST/todo.js:$LINE:$COL)', + ' ...', + '', + '1..2', + '# tests 2', + '# pass 2', + '', + '# ok', + '' + ]); + })); - test('success', function (t) { - t.equal(true, true, 'this test runs'); - t.end(); - }); + test('success', function (t) { + t.equal(true, true, 'this test runs'); + t.end(); + }); - test('failure', { todo: true }, function (t) { - t.fail('should never happen'); - t.end(); - }); + test('failure', { todo: true }, function (t) { + t.fail('should never happen'); + t.end(); + }); }); diff --git a/test/todo_explanation.js b/test/todo_explanation.js index 72c559ed..683dc794 100644 --- a/test/todo_explanation.js +++ b/test/todo_explanation.js @@ -8,63 +8,63 @@ var common = require('./common'); var stripFullStack = common.stripFullStack; tap.test('tape todo test', { todo: process.versions.node.match(/0\.8\.\d+/) ? 'Fails on node 0.8' : false }, function (assert) { - var test = tape.createHarness({ exit: false }); - assert.plan(1); + var test = tape.createHarness({ exit: false }); + assert.plan(1); - test.createStream().pipe(concat(function (body) { - assert.same(stripFullStack(body.toString('utf8')), [ - 'TAP version 13', - '# success', - 'ok 1 this test runs', - '# TODO incomplete test1', - 'not ok 2 check output # TODO', - ' ---', - ' operator: equal', - ' expected: false', - ' actual: true', - ' at: Test. ($TEST/todo_explanation.js:$LINE:$COL)', - ' ...', - 'not ok 3 check vars output # TODO name conflict', - ' ---', - ' operator: equal', - ' expected: 0', - ' actual: 1', - ' at: Test. ($TEST/todo_explanation.js:$LINE:$COL)', - ' ...', - '# incomplete test2', - 'not ok 4 run openssl # TODO installer needs fix', - ' ---', - ' operator: fail', - ' at: Test. ($TEST/todo_explanation.js:$LINE:$COL)', - ' ...', - '# TODO passing test', - '', - '1..4', - '# tests 4', - '# pass 4', - '', - '# ok', - '' - ]); - })); + test.createStream().pipe(concat(function (body) { + assert.same(stripFullStack(body.toString('utf8')), [ + 'TAP version 13', + '# success', + 'ok 1 this test runs', + '# TODO incomplete test1', + 'not ok 2 check output # TODO', + ' ---', + ' operator: equal', + ' expected: false', + ' actual: true', + ' at: Test. ($TEST/todo_explanation.js:$LINE:$COL)', + ' ...', + 'not ok 3 check vars output # TODO name conflict', + ' ---', + ' operator: equal', + ' expected: 0', + ' actual: 1', + ' at: Test. ($TEST/todo_explanation.js:$LINE:$COL)', + ' ...', + '# incomplete test2', + 'not ok 4 run openssl # TODO installer needs fix', + ' ---', + ' operator: fail', + ' at: Test. ($TEST/todo_explanation.js:$LINE:$COL)', + ' ...', + '# TODO passing test', + '', + '1..4', + '# tests 4', + '# pass 4', + '', + '# ok', + '' + ]); + })); - test('success', function (t) { - t.equal(true, true, 'this test runs'); - t.end(); - }); + test('success', function (t) { + t.equal(true, true, 'this test runs'); + t.end(); + }); - test('incomplete test1', { todo: true }, function (t) { - t.equal(true, false, 'check output'); - t.equal(1, 0, 'check vars output', { todo: 'name conflict' }); - t.end(); - }); + test('incomplete test1', { todo: true }, function (t) { + t.equal(true, false, 'check output'); + t.equal(1, 0, 'check vars output', { todo: 'name conflict' }); + t.end(); + }); - test('incomplete test2', function (t) { - t.fail('run openssl', { todo: 'installer needs fix' }); - t.end(); - }); + test('incomplete test2', function (t) { + t.fail('run openssl', { todo: 'installer needs fix' }); + t.end(); + }); - test('passing test', { todo: 'yet incomplete' }, function (t) { - t.end(); - }); + test('passing test', { todo: 'yet incomplete' }, function (t) { + t.end(); + }); }); diff --git a/test/todo_single.js b/test/todo_single.js index d9da7eaa..1e81192e 100644 --- a/test/todo_single.js +++ b/test/todo_single.js @@ -8,32 +8,32 @@ var common = require('./common'); var stripFullStack = common.stripFullStack; tap.test('tape todo test', function (assert) { - var test = tape.createHarness({ exit: false }); - assert.plan(1); + var test = tape.createHarness({ exit: false }); + assert.plan(1); - test.createStream().pipe(concat(function (body) { - assert.same(stripFullStack(body.toString('utf8')), [ - 'TAP version 13', - '# TODO failure', - 'not ok 1 should be equal # TODO', - ' ---', - ' operator: equal', - ' expected: false', - ' actual: true', - ' at: Test. ($TEST/todo_single.js:$LINE:$COL)', - ' ...', - '', - '1..1', - '# tests 1', - '# pass 1', - '', - '# ok', - '' - ]); - })); + test.createStream().pipe(concat(function (body) { + assert.same(stripFullStack(body.toString('utf8')), [ + 'TAP version 13', + '# TODO failure', + 'not ok 1 should be equal # TODO', + ' ---', + ' operator: equal', + ' expected: false', + ' actual: true', + ' at: Test. ($TEST/todo_single.js:$LINE:$COL)', + ' ...', + '', + '1..1', + '# tests 1', + '# pass 1', + '', + '# ok', + '' + ]); + })); - test('failure', { todo: true }, function (t) { - t.equal(true, false); - t.end(); - }); + test('failure', { todo: true }, function (t) { + t.equal(true, false); + t.end(); + }); }); diff --git a/test/too_many.js b/test/too_many.js index 86131d85..56960ca0 100644 --- a/test/too_many.js +++ b/test/too_many.js @@ -8,74 +8,74 @@ var concat = require('concat-stream'); var stripFullStack = require('./common').stripFullStack; tap.test('array test', function (tt) { - tt.plan(1); + tt.plan(1); - var test = tape.createHarness({ exit: false }); - var tc = function (rows) { - tt.same(stripFullStack(rows.toString('utf8')), [ - 'TAP version 13', - '# array', - 'ok 1 should be equivalent', - 'ok 2 should be equivalent', - 'ok 3 should be equivalent', - 'ok 4 should be equivalent', - 'not ok 5 plan != count', - ' ---', - ' operator: fail', - ' expected: 3', - ' actual: 4', - ' at: ($TEST/too_many.js:$LINE:$COL)', - ' stack: |-', - ' Error: plan != count', - ' [... stack stripped ...]', - ' at $TEST/too_many.js:$LINE:$COL', - ' at eval (eval at ($TEST/too_many.js:$LINE:$COL))', - ' at eval (eval at ($TEST/too_many.js:$LINE:$COL))', - ' at Test. ($TEST/too_many.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - 'ok 6 should be equivalent', - '', - '1..6', - '# tests 6', - '# pass 5', - '# fail 1', - '' - ]); - }; + var test = tape.createHarness({ exit: false }); + var tc = function (rows) { + tt.same(stripFullStack(rows.toString('utf8')), [ + 'TAP version 13', + '# array', + 'ok 1 should be equivalent', + 'ok 2 should be equivalent', + 'ok 3 should be equivalent', + 'ok 4 should be equivalent', + 'not ok 5 plan != count', + ' ---', + ' operator: fail', + ' expected: 3', + ' actual: 4', + ' at: ($TEST/too_many.js:$LINE:$COL)', + ' stack: |-', + ' Error: plan != count', + ' [... stack stripped ...]', + ' at $TEST/too_many.js:$LINE:$COL', + ' at eval (eval at ($TEST/too_many.js:$LINE:$COL))', + ' at eval (eval at ($TEST/too_many.js:$LINE:$COL))', + ' at Test. ($TEST/too_many.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + 'ok 6 should be equivalent', + '', + '1..6', + '# tests 6', + '# pass 5', + '# fail 1', + '' + ]); + }; - test.createStream().pipe(concat(tc)); + test.createStream().pipe(concat(tc)); - test('array', function (t) { - t.plan(3); + test('array', function (t) { + t.plan(3); - var src = '(' + function () { - var xs = [1, 2, [3, 4]]; - var ys = [5, 6]; - g([xs, ys]); - } + ')()'; + var src = '(' + function () { + var xs = [1, 2, [3, 4]]; + var ys = [5, 6]; + g([xs, ys]); + } + ')()'; - var output = falafel(src, function (node) { - if (node.type === 'ArrayExpression') { - node.update('fn(' + node.source() + ')'); - } - }); + var output = falafel(src, function (node) { + if (node.type === 'ArrayExpression') { + node.update('fn(' + node.source() + ')'); + } + }); - var arrays = [ - [3, 4], - [1, 2, [3, 4]], - [5, 6], - [[1, 2, [3, 4]], [5, 6]] - ]; + var arrays = [ + [3, 4], + [1, 2, [3, 4]], + [5, 6], + [[1, 2, [3, 4]], [5, 6]] + ]; - Function(['fn', 'g'], output)( - function (xs) { - t.same(arrays.shift(), xs); - return xs; - }, - function (xs) { - t.same(xs, [[1, 2, [3, 4]], [5, 6]]); - } - ); - }); + Function(['fn', 'g'], output)( + function (xs) { + t.same(arrays.shift(), xs); + return xs; + }, + function (xs) { + t.same(xs, [[1, 2, [3, 4]], [5, 6]]); + } + ); + }); }); diff --git a/test/undef.js b/test/undef.js index 42846a29..63ab3649 100644 --- a/test/undef.js +++ b/test/undef.js @@ -7,38 +7,38 @@ var concat = require('concat-stream'); var stripFullStack = require('./common').stripFullStack; tap.test('array test', function (tt) { - tt.plan(1); + tt.plan(1); - var test = tape.createHarness(); - test.createStream().pipe(concat(function (body) { - tt.same(stripFullStack(body.toString('utf8')), [ - 'TAP version 13', - '# undef', - 'not ok 1 should be equivalent', - ' ---', - ' operator: deepEqual', - ' expected: |-', - ' { beep: undefined }', - ' actual: |-', - ' {}', - ' at: Test. ($TEST/undef.js:$LINE:$COL)', - ' stack: |-', - ' Error: should be equivalent', - ' [... stack stripped ...]', - ' at Test. ($TEST/undef.js:$LINE:$COL)', - ' [... stack stripped ...]', - ' ...', - '', - '1..1', - '# tests 1', - '# pass 0', - '# fail 1', - '' - ]); - })); + var test = tape.createHarness(); + test.createStream().pipe(concat(function (body) { + tt.same(stripFullStack(body.toString('utf8')), [ + 'TAP version 13', + '# undef', + 'not ok 1 should be equivalent', + ' ---', + ' operator: deepEqual', + ' expected: |-', + ' { beep: undefined }', + ' actual: |-', + ' {}', + ' at: Test. ($TEST/undef.js:$LINE:$COL)', + ' stack: |-', + ' Error: should be equivalent', + ' [... stack stripped ...]', + ' at Test. ($TEST/undef.js:$LINE:$COL)', + ' [... stack stripped ...]', + ' ...', + '', + '1..1', + '# tests 1', + '# pass 0', + '# fail 1', + '' + ]); + })); - test('undef', function (t) { - t.plan(1); - t.deepEqual({}, { beep: undefined }); - }); + test('undef', function (t) { + t.plan(1); + t.deepEqual({}, { beep: undefined }); + }); }); From 65df5a4f194cf01c3872c713d129ac968342181c Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sat, 17 Sep 2022 21:38:27 -0700 Subject: [PATCH 05/11] [Tests] `stackTrace`: use the common `getDiag` utility --- test/common.js | 6 ++-- test/stackTrace.js | 90 ++++++++++++++++++++-------------------------- 2 files changed, 43 insertions(+), 53 deletions(-) diff --git a/test/common.js b/test/common.js index c5b9241b..a30302aa 100644 --- a/test/common.js +++ b/test/common.js @@ -3,7 +3,7 @@ var path = require('path'); var yaml = require('js-yaml'); -module.exports.getDiag = function (body) { +module.exports.getDiag = function (body, includeStack) { var yamlStart = body.indexOf(' ---'); var yamlEnd = body.indexOf(' ...\n'); var diag = body.slice(yamlStart, yamlEnd).split('\n').map(function (line) { @@ -13,7 +13,9 @@ module.exports.getDiag = function (body) { // The stack trace and at variable will vary depending on where the code // is run, so just strip it out. var withStack = yaml.safeLoad(diag); - delete withStack.stack; + if (!includeStack) { + delete withStack.stack; + } delete withStack.at; return withStack; }; diff --git a/test/stackTrace.js b/test/stackTrace.js index b55afff4..0d0723e8 100644 --- a/test/stackTrace.js +++ b/test/stackTrace.js @@ -4,7 +4,9 @@ var tape = require('../'); var tap = require('tap'); var concat = require('concat-stream'); var tapParser = require('tap-parser'); -var yaml = require('js-yaml'); +var common = require('./common'); + +var getDiag = common.getDiag; tap.test('preserves stack trace with newlines', function (tt) { tt.plan(3); @@ -34,26 +36,26 @@ tap.test('preserves stack trace with newlines', function (tt) { tt.equal( strippedBody, 'TAP version 13\n' - + '# multiline stack trace\n' - + 'not ok 1 Error: Preserve stack\n' - + ' ---\n' - + ' operator: error\n' - + ' expected: |-\n' - + ' undefined\n' - + ' actual: |-\n' - + ' [Error: Preserve stack]\n' - + ' stack: |-\n' - + ' foo\n' - + ' bar\n' - + ' ...\n' - + '\n' - + '1..1\n' - + '# tests 1\n' - + '# pass 0\n' - + '# fail 1\n' + + '# multiline stack trace\n' + + 'not ok 1 Error: Preserve stack\n' + + ' ---\n' + + ' operator: error\n' + + ' expected: |-\n' + + ' undefined\n' + + ' actual: |-\n' + + ' [Error: Preserve stack]\n' + + ' stack: |-\n' + + ' foo\n' + + ' bar\n' + + ' ...\n' + + '\n' + + '1..1\n' + + '# tests 1\n' + + '# pass 0\n' + + '# fail 1\n' ); - tt.deepEqual(getDiag(strippedBody), { + tt.deepEqual(getDiag(strippedBody, true), { stack: stackTrace, operator: 'error', expected: 'undefined', @@ -198,25 +200,25 @@ tap.test('preserves stack trace for failed assertions', function (tt) { tt.equal( strippedBody, 'TAP version 13\n' - + '# t.equal stack trace\n' - + 'not ok 1 true should be false\n' - + ' ---\n' - + ' operator: equal\n' - + ' expected: false\n' - + ' actual: true\n' - + ' stack: |-\n' - + ' ' - + stack.replace(/\n/g, '\n ') - + '\n' - + ' ...\n' - + '\n' - + '1..1\n' - + '# tests 1\n' - + '# pass 0\n' - + '# fail 1\n' + + '# t.equal stack trace\n' + + 'not ok 1 true should be false\n' + + ' ---\n' + + ' operator: equal\n' + + ' expected: false\n' + + ' actual: true\n' + + ' stack: |-\n' + + ' ' + + stack.replace(/\n/g, '\n ') + + '\n' + + ' ...\n' + + '\n' + + '1..1\n' + + '# tests 1\n' + + '# pass 0\n' + + '# fail 1\n' ); - tt.deepEqual(getDiag(strippedBody), { + tt.deepEqual(getDiag(strippedBody, true), { stack: stack, operator: 'equal', expected: false, @@ -281,7 +283,7 @@ tap.test('preserves stack trace for failed assertions where actual===falsy', fun + '# fail 1\n' ); - tt.deepEqual(getDiag(strippedBody), { + tt.deepEqual(getDiag(strippedBody, true), { stack: stack, operator: 'equal', expected: true, @@ -295,20 +297,6 @@ tap.test('preserves stack trace for failed assertions where actual===falsy', fun }); }); -function getDiag(body) { - var yamlStart = body.indexOf(' ---'); - var yamlEnd = body.indexOf(' ...\n'); - var diag = body.slice(yamlStart, yamlEnd).split('\n').map(function (line) { - return line.slice(2); - }).join('\n'); - - // Get rid of 'at' variable (which has a line number / path of its own that's - // difficult to check). - var withStack = yaml.safeLoad(diag); - delete withStack.at; - return withStack; -} - function stripAt(body) { return body.replace(/^\s*at:\s+Test.*$\n/m, ''); } From 87deb68b111fd0d94efc92c25454a6a3fcedff66 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Mon, 19 Sep 2022 15:48:08 -0700 Subject: [PATCH 06/11] [eslint] enforce `no-use-before-define` --- .eslintrc | 7 +- index.js | 111 +++++++++++------------ lib/results.js | 142 +++++++++++++++--------------- lib/test.js | 34 +++---- package.json | 7 +- test/anonymous-fn/test-wrapper.js | 16 ++-- test/end-as-callback.js | 78 ++++++++-------- test/require.js | 12 +-- test/stackTrace.js | 8 +- 9 files changed, 212 insertions(+), 203 deletions(-) diff --git a/.eslintrc b/.eslintrc index 674fac4a..6e61464a 100644 --- a/.eslintrc +++ b/.eslintrc @@ -21,7 +21,6 @@ "no-negated-condition": "off", "no-param-reassign": "warn", "no-underscore-dangle": "warn", - "no-use-before-define": "warn", "object-curly-newline": "off", "operator-linebreak": ["error", "before"], "sort-keys": "warn", @@ -121,5 +120,11 @@ "camelcase": "off", }, }, + { + "files": ["lib/default_stream.js"], + "rules": { + "no-use-before-define": "warn", + }, + } ], } diff --git a/index.js b/index.js index c6dfd197..2d2d2e53 100644 --- a/index.js +++ b/index.js @@ -13,6 +13,16 @@ var canExit = typeof process !== 'undefined' && process module.exports = (function () { var harness; + + function getHarness(opts) { + if (!opts) { opts = {}; } + opts.autoclose = !canEmitExit; + // this override is here since tests fail via nyc if createHarness is moved upwards + // eslint-disable-next-line no-use-before-define + if (!harness) { harness = createExitHarness(opts); } + return harness; + } + var lazyLoad = function () { // eslint-disable-next-line no-invalid-this return getHarness().apply(this, arguments); @@ -43,62 +53,8 @@ module.exports = (function () { lazyLoad.getHarness = getHarness; return lazyLoad; - - function getHarness(opts) { - if (!opts) { opts = {}; } - opts.autoclose = !canEmitExit; - if (!harness) { harness = createExitHarness(opts); } - return harness; - } }()); -function createExitHarness(conf) { - var config = conf || {}; - var harness = createHarness({ - autoclose: defined(config.autoclose, false), - noOnly: defined(conf.noOnly, defined(process.env.NODE_TAPE_NO_ONLY_TEST, false)) - }); - - var stream = harness.createStream({ objectMode: conf.objectMode }); - var es = stream.pipe(conf.stream || createDefaultStream()); - if (canEmitExit) { - // eslint-disable-next-line no-unused-vars - es.on('error', function (err) { harness._exitCode = 1; }); - } - - var ended = false; - stream.on('end', function () { ended = true; }); - - if (config.exit === false) { return harness; } - if (!canEmitExit || !canExit) { return harness; } - - process.on('exit', function (code) { - // let the process exit cleanly. - if (code !== 0) { - return; - } - - if (!ended) { - var only = harness._results._only; - for (var i = 0; i < harness._tests.length; i++) { - var t = harness._tests[i]; - if (!only || t === only) { - t._exit(); - } - } - } - harness.close(); - process.exit(code || harness._exitCode); // eslint-disable-line no-process-exit - }); - - return harness; -} - -module.exports.createHarness = createHarness; -module.exports.Test = Test; -module.exports.test = module.exports; // tap compat -module.exports.test.skip = Test.skip; - function createHarness(conf_) { var results = createResult(); if (!conf_ || conf_.autoclose !== false) { @@ -152,3 +108,50 @@ function createHarness(conf_) { return test; } + +function createExitHarness(conf) { + var config = conf || {}; + var harness = createHarness({ + autoclose: defined(config.autoclose, false), + noOnly: defined(conf.noOnly, defined(process.env.NODE_TAPE_NO_ONLY_TEST, false)) + }); + + var stream = harness.createStream({ objectMode: conf.objectMode }); + var es = stream.pipe(conf.stream || createDefaultStream()); + if (canEmitExit) { + // eslint-disable-next-line no-unused-vars + es.on('error', function (err) { harness._exitCode = 1; }); + } + + var ended = false; + stream.on('end', function () { ended = true; }); + + if (config.exit === false) { return harness; } + if (!canEmitExit || !canExit) { return harness; } + + process.on('exit', function (code) { + // let the process exit cleanly. + if (code !== 0) { + return; + } + + if (!ended) { + var only = harness._results._only; + for (var i = 0; i < harness._tests.length; i++) { + var t = harness._tests[i]; + if (!only || t === only) { + t._exit(); + } + } + } + harness.close(); + process.exit(code || harness._exitCode); // eslint-disable-line no-process-exit + }); + + return harness; +} + +module.exports.createHarness = createHarness; +module.exports.Test = Test; +module.exports.test = module.exports; // tap compat +module.exports.test.skip = Test.skip; diff --git a/lib/results.js b/lib/results.js index 7554da62..2460a712 100644 --- a/lib/results.js +++ b/lib/results.js @@ -11,13 +11,80 @@ var has = require('has'); var $exec = callBound('RegExp.prototype.exec'); var yamlIndicators = /:|-|\?/; var nextTick = typeof setImmediate !== 'undefined' ? setImmediate : process.nextTick; -module.exports = Results; -inherits(Results, EventEmitter); function coalesceWhiteSpaces(str) { return String(str).replace(/\s+/g, ' '); } +function invalidYaml(str) { + return $exec(yamlIndicators, str) !== null; +} + +function encodeResult(res, count) { + var output = ''; + output += (res.ok ? 'ok ' : 'not ok ') + count; + output += res.name ? ' ' + coalesceWhiteSpaces(res.name) : ''; + + if (res.skip) { + output += ' # SKIP' + (typeof res.skip === 'string' ? ' ' + coalesceWhiteSpaces(res.skip) : ''); + } else if (res.todo) { + output += ' # TODO' + (typeof res.todo === 'string' ? ' ' + coalesceWhiteSpaces(res.todo) : ''); + } + + output += '\n'; + if (res.ok) { return output; } + + var outer = ' '; + var inner = outer + ' '; + output += outer + '---\n'; + output += inner + 'operator: ' + res.operator + '\n'; + + if (has(res, 'expected') || has(res, 'actual')) { + var ex = inspect(res.expected, { depth: res.objectPrintDepth }); + var ac = inspect(res.actual, { depth: res.objectPrintDepth }); + + if (Math.max(ex.length, ac.length) > 65 || invalidYaml(ex) || invalidYaml(ac)) { + output += inner + 'expected: |-\n' + inner + ' ' + ex + '\n'; + output += inner + 'actual: |-\n' + inner + ' ' + ac + '\n'; + } else { + output += inner + 'expected: ' + ex + '\n'; + output += inner + 'actual: ' + ac + '\n'; + } + } + if (res.at) { + output += inner + 'at: ' + res.at + '\n'; + } + + var actualStack = res.actual && (typeof res.actual === 'object' || typeof res.actual === 'function') ? res.actual.stack : undefined; + var errorStack = res.error && res.error.stack; + var stack = defined(actualStack, errorStack); + if (stack) { + var lines = String(stack).split('\n'); + output += inner + 'stack: |-\n'; + for (var i = 0; i < lines.length; i++) { + output += inner + ' ' + lines[i] + '\n'; + } + } + + output += outer + '...\n'; + return output; +} + +function getNextTest(results) { + if (!results._only) { + return results.tests.shift(); + } + + do { + var t = results.tests.shift(); + if (t && results._only === t) { + return t; + } + } while (results.tests.length !== 0); + + return void undefined; +} + function Results() { if (!(this instanceof Results)) { return new Results(); } this.count = 0; @@ -30,6 +97,8 @@ function Results() { this._isRunning = false; } +inherits(Results, EventEmitter); + Results.prototype.createStream = function (opts) { if (!opts) { opts = {}; } var self = this; @@ -155,71 +224,4 @@ Results.prototype.close = function () { self._stream.queue(null); }; -function encodeResult(res, count) { - var output = ''; - output += (res.ok ? 'ok ' : 'not ok ') + count; - output += res.name ? ' ' + coalesceWhiteSpaces(res.name) : ''; - - if (res.skip) { - output += ' # SKIP' + (typeof res.skip === 'string' ? ' ' + coalesceWhiteSpaces(res.skip) : ''); - } else if (res.todo) { - output += ' # TODO' + (typeof res.todo === 'string' ? ' ' + coalesceWhiteSpaces(res.todo) : ''); - } - - output += '\n'; - if (res.ok) { return output; } - - var outer = ' '; - var inner = outer + ' '; - output += outer + '---\n'; - output += inner + 'operator: ' + res.operator + '\n'; - - if (has(res, 'expected') || has(res, 'actual')) { - var ex = inspect(res.expected, { depth: res.objectPrintDepth }); - var ac = inspect(res.actual, { depth: res.objectPrintDepth }); - - if (Math.max(ex.length, ac.length) > 65 || invalidYaml(ex) || invalidYaml(ac)) { - output += inner + 'expected: |-\n' + inner + ' ' + ex + '\n'; - output += inner + 'actual: |-\n' + inner + ' ' + ac + '\n'; - } else { - output += inner + 'expected: ' + ex + '\n'; - output += inner + 'actual: ' + ac + '\n'; - } - } - if (res.at) { - output += inner + 'at: ' + res.at + '\n'; - } - - var actualStack = res.actual && (typeof res.actual === 'object' || typeof res.actual === 'function') ? res.actual.stack : undefined; - var errorStack = res.error && res.error.stack; - var stack = defined(actualStack, errorStack); - if (stack) { - var lines = String(stack).split('\n'); - output += inner + 'stack: |-\n'; - for (var i = 0; i < lines.length; i++) { - output += inner + ' ' + lines[i] + '\n'; - } - } - - output += outer + '...\n'; - return output; -} - -function getNextTest(results) { - if (!results._only) { - return results.tests.shift(); - } - - do { - var t = results.tests.shift(); - if (t && results._only === t) { - return t; - } - } while (results.tests.length !== 0); - - return void undefined; -} - -function invalidYaml(str) { - return $exec(yamlIndicators, str) !== null; -} +module.exports = Results; diff --git a/lib/test.js b/lib/test.js index 9b369492..c43b57a4 100644 --- a/lib/test.js +++ b/lib/test.js @@ -16,16 +16,12 @@ var toLowerCase = callBound('String.prototype.toLowerCase'); var $exec = callBound('RegExp.prototype.exec'); var objectToString = callBound('Object.prototype.toString'); -module.exports = Test; - var nextTick = typeof setImmediate !== 'undefined' ? setImmediate : process.nextTick; var safeSetTimeout = setTimeout; var safeClearTimeout = clearTimeout; -inherits(Test, EventEmitter); - // eslint-disable-next-line no-unused-vars var getTestArgs = function (name_, opts_, cb_) { var name = '(anonymous)'; @@ -94,6 +90,8 @@ function Test(name_, opts_, cb_) { } } +inherits(Test, EventEmitter); + Test.prototype.run = function run() { this.emit('prerun'); if (!this._cb || this._skip) { @@ -183,6 +181,19 @@ Test.prototype._end = function (err) { return; } + function completeEnd() { + if (!self.ended) { self.emit('end'); } + var pendingAsserts = self._pendingAsserts(); + if (!self._planError && self._plan !== undefined && pendingAsserts) { + self._planError = true; + self.fail('plan != count', { + expected: self._plan, + actual: self.assertCount + }); + } + self.ended = true; + } + function next(i) { if (i === self._teardown.length) { completeEnd(); @@ -211,19 +222,6 @@ Test.prototype._end = function (err) { } else { completeEnd(); } - - function completeEnd() { - if (!self.ended) { self.emit('end'); } - var pendingAsserts = self._pendingAsserts(); - if (!self._planError && self._plan !== undefined && pendingAsserts) { - self._planError = true; - self.fail('plan != count', { - expected: self._plan, - actual: self.assertCount - }); - } - self.ended = true; - } }; Test.prototype._exit = function () { @@ -665,4 +663,6 @@ Test.skip = function (name_, _opts, _cb) { return new Test(args.name, args.opts, args.cb); }; +module.exports = Test; + // vim: set softtabstop=4 shiftwidth=4: diff --git a/package.json b/package.json index 1c4e3f5b..eb4ac383 100644 --- a/package.json +++ b/package.json @@ -82,10 +82,9 @@ "assert", "browser" ], - "author": { - "name": "Jordan Harband", - "email": "ljharb@gmail.com", - "url": "http://ljharb.codes" + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" }, "license": "MIT" } diff --git a/test/anonymous-fn/test-wrapper.js b/test/anonymous-fn/test-wrapper.js index 0c42f00e..7a35bae9 100644 --- a/test/anonymous-fn/test-wrapper.js +++ b/test/anonymous-fn/test-wrapper.js @@ -1,5 +1,13 @@ 'use strict'; +function setUp() { + // ... example ... +} + +function tearDown() { + // ... example ... +} + // Example of wrapper function that would invoke tape module.exports = function (testCase) { return function (t) { @@ -8,11 +16,3 @@ module.exports = function (testCase) { tearDown(); }; }; - -function setUp() { - // ... example ... -} - -function tearDown() { - // ... example ... -} diff --git a/test/end-as-callback.js b/test/end-as-callback.js index af7babad..42de7066 100644 --- a/test/end-as-callback.js +++ b/test/end-as-callback.js @@ -5,6 +5,45 @@ var forEach = require('for-each'); var tape = require('../'); var concat = require('concat-stream'); +function fakeAsyncTask(name, cb) { + cb(null, 'task' + name); +} + +function fakeAsyncWrite(name, cb) { + cb(null); +} + +function fakeAsyncWriteFail(name, cb) { + cb(new Error('fail')); +} + +/** + * extract the stack trace for the failed test. + * this will change dependent on the environment + * so no point hard-coding it in the test assertion + * see: https://git.io/v6hGG for example + * @param String rows - the tap output lines + * @returns String stacktrace - just the error stack part + */ +function getStackTrace(rows) { + var stacktrace = ' ---\n'; + var extract = false; + forEach(rows.toString('utf8').split('\n'), function (row) { + if (!extract) { + if (row.indexOf('---') > -1) { // start of stack trace + extract = true; + } + } else if (row.indexOf('...') > -1) { // end of stack trace + extract = false; + stacktrace += ' ...'; + } else { + stacktrace += row + '\n'; + } + }); + // console.log(stacktrace); + return stacktrace; +} + tap.test('tape assert.end as callback', function (tt) { var test = tape.createHarness({ exit: false }); @@ -46,42 +85,3 @@ tap.test('tape assert.end as callback', function (tt) { }); }); }); - -function fakeAsyncTask(name, cb) { - cb(null, 'task' + name); -} - -function fakeAsyncWrite(name, cb) { - cb(null); -} - -function fakeAsyncWriteFail(name, cb) { - cb(new Error('fail')); -} - -/** - * extract the stack trace for the failed test. - * this will change dependent on the environment - * so no point hard-coding it in the test assertion - * see: https://git.io/v6hGG for example - * @param String rows - the tap output lines - * @returns String stacktrace - just the error stack part - */ -function getStackTrace(rows) { - var stacktrace = ' ---\n'; - var extract = false; - forEach(rows.toString('utf8').split('\n'), function (row) { - if (!extract) { - if (row.indexOf('---') > -1) { // start of stack trace - extract = true; - } - } else if (row.indexOf('...') > -1) { // end of stack trace - extract = false; - stacktrace += ' ...'; - } else { - stacktrace += row + '\n'; - } - }); - // console.log(stacktrace); - return stacktrace; -} diff --git a/test/require.js b/test/require.js index 724f40cf..c4b48143 100644 --- a/test/require.js +++ b/test/require.js @@ -4,6 +4,12 @@ var tap = require('tap'); var spawn = require('child_process').spawn; var concat = require('concat-stream'); +function tape(args) { + var bin = __dirname + '/../bin/tape'; + + return spawn('node', [bin].concat(args.split(' ')), { cwd: __dirname }); +} + tap.test('requiring a single module', function (t) { t.plan(2); @@ -62,9 +68,3 @@ tap.test('requiring multiple modules', function (t) { t.equal(code, 0); }); }); - -function tape(args) { - var bin = __dirname + '/../bin/tape'; - - return spawn('node', [bin].concat(args.split(' ')), { cwd: __dirname }); -} diff --git a/test/stackTrace.js b/test/stackTrace.js index 0d0723e8..317e2335 100644 --- a/test/stackTrace.js +++ b/test/stackTrace.js @@ -8,6 +8,10 @@ var common = require('./common'); var getDiag = common.getDiag; +function stripAt(body) { + return body.replace(/^\s*at:\s+Test.*$\n/m, ''); +} + tap.test('preserves stack trace with newlines', function (tt) { tt.plan(3); @@ -296,7 +300,3 @@ tap.test('preserves stack trace for failed assertions where actual===falsy', fun t.equal(false, true, 'false should be true'); }); }); - -function stripAt(body) { - return body.replace(/^\s*at:\s+Test.*$\n/m, ''); -} From 75c0c3a4f9452c36b5318ba6c09ab4ebc97f15d0 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Mon, 19 Sep 2022 10:48:21 -0700 Subject: [PATCH 07/11] [eslint] enable `func-style` --- .eslintrc | 3 ++- index.js | 8 ++++---- lib/results.js | 4 ++-- lib/test.js | 5 +++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.eslintrc b/.eslintrc index 6e61464a..4d02509e 100644 --- a/.eslintrc +++ b/.eslintrc @@ -12,7 +12,7 @@ "rules": { "array-bracket-spacing": "off", "complexity": "off", - "func-style": "warn", + "func-style": ["error", "declaration"], "max-lines-per-function": "warn", "max-lines": "warn", "max-statements-per-line": [2, { "max": 2 }], @@ -107,6 +107,7 @@ "allowKeywords": true, "allowPattern": "throws" }], + "func-style": "off", "id-length": "off", "max-len": "off", "max-lines-per-function": "off", diff --git a/index.js b/index.js index 2d2d2e53..1a11e3ca 100644 --- a/index.js +++ b/index.js @@ -23,10 +23,10 @@ module.exports = (function () { return harness; } - var lazyLoad = function () { + function lazyLoad() { // eslint-disable-next-line no-invalid-this return getHarness().apply(this, arguments); - }; + } lazyLoad.only = function () { return getHarness().only.apply(this, arguments); @@ -61,7 +61,7 @@ function createHarness(conf_) { results.once('done', function () { results.close(); }); } - var test = function (name, conf, cb) { + function test(name, conf, cb) { var t = new Test(name, conf, cb); test._tests.push(t); @@ -76,7 +76,7 @@ function createHarness(conf_) { results.push(t); return t; - }; + } test._results = results; test._tests = []; diff --git a/lib/results.js b/lib/results.js index 2460a712..23fc0734 100644 --- a/lib/results.js +++ b/lib/results.js @@ -174,7 +174,7 @@ Results.prototype.only = function (t) { Results.prototype._watch = function (t) { var self = this; - var write = function (s) { self._stream.queue(s); }; + function write(s) { self._stream.queue(s); } t.once('prerun', function () { var premsg = ''; if (t._skip) { @@ -208,7 +208,7 @@ Results.prototype.close = function () { var self = this; if (self.closed) { self._stream.emit('error', new Error('ALREADY CLOSED')); } self.closed = true; - var write = function (s) { self._stream.queue(s); }; + function write(s) { self._stream.queue(s); } write('\n1..' + self.count + '\n'); write('# tests ' + self.count + '\n'); diff --git a/lib/test.js b/lib/test.js index c43b57a4..596f83a5 100644 --- a/lib/test.js +++ b/lib/test.js @@ -23,7 +23,7 @@ var safeSetTimeout = setTimeout; var safeClearTimeout = clearTimeout; // eslint-disable-next-line no-unused-vars -var getTestArgs = function (name_, opts_, cb_) { +function getTestArgs(name_, opts_, cb_) { var name = '(anonymous)'; var opts = {}; var cb; @@ -44,7 +44,7 @@ var getTestArgs = function (name_, opts_, cb_) { opts: opts, cb: cb }; -}; +} function Test(name_, opts_, cb_) { if (!(this instanceof Test)) { @@ -387,6 +387,7 @@ Test.prototype.skip = function (msg, extra) { }); }; +// eslint-disable-next-line func-style var tapeAssert = function assert(value, msg, extra) { this._assert(value, { message: defined(msg, 'should be truthy'), From 3171eddd25dafb3e9a9606ac70ed6c21bb736e8e Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Mon, 19 Sep 2022 11:18:24 -0700 Subject: [PATCH 08/11] [eslint] clean up config a bit --- .eslintrc | 15 ++++-- test/stackTrace.js | 118 ++++++++++++++++++++++----------------------- 2 files changed, 67 insertions(+), 66 deletions(-) diff --git a/.eslintrc b/.eslintrc index 4d02509e..197e767f 100644 --- a/.eslintrc +++ b/.eslintrc @@ -13,8 +13,7 @@ "array-bracket-spacing": "off", "complexity": "off", "func-style": ["error", "declaration"], - "max-lines-per-function": "warn", - "max-lines": "warn", + "max-lines-per-function": "off", "max-statements-per-line": [2, { "max": 2 }], "max-statements": "warn", "multiline-comment-style": "off", @@ -22,8 +21,7 @@ "no-param-reassign": "warn", "no-underscore-dangle": "warn", "object-curly-newline": "off", - "operator-linebreak": ["error", "before"], - "sort-keys": "warn", + "sort-keys": "off", }, "ignorePatterns": [ "syntax-error.*", @@ -75,6 +73,7 @@ "no-plusplus": "warn", "no-multi-assign": "off", "no-restricted-syntax": "off", + "operator-linebreak": ["error", "before"], }, }, { @@ -126,6 +125,12 @@ "rules": { "no-use-before-define": "warn", }, - } + }, + { + "files": ["lib/test.js"], + "rules": { + "max-lines": "off", + }, + }, ], } diff --git a/test/stackTrace.js b/test/stackTrace.js index 317e2335..22ca6ce7 100644 --- a/test/stackTrace.js +++ b/test/stackTrace.js @@ -37,27 +37,27 @@ tap.test('preserves stack trace with newlines', function (tt) { stream.pipe(concat(function (body) { var strippedBody = stripAt(body.toString('utf8')); - tt.equal( - strippedBody, - 'TAP version 13\n' - + '# multiline stack trace\n' - + 'not ok 1 Error: Preserve stack\n' - + ' ---\n' - + ' operator: error\n' - + ' expected: |-\n' - + ' undefined\n' - + ' actual: |-\n' - + ' [Error: Preserve stack]\n' - + ' stack: |-\n' - + ' foo\n' - + ' bar\n' - + ' ...\n' - + '\n' - + '1..1\n' - + '# tests 1\n' - + '# pass 0\n' - + '# fail 1\n' - ); + tt.deepEqual(strippedBody.split('\n'), [].concat( + 'TAP version 13', + '# multiline stack trace', + 'not ok 1 Error: Preserve stack', + ' ---', + ' operator: error', + ' expected: |-', + ' undefined', + ' actual: |-', + ' [Error: Preserve stack]', + ' stack: |-', + ' foo', + ' bar', + ' ...', + '', + '1..1', + '# tests 1', + '# pass 0', + '# fail 1', + '' + )); tt.deepEqual(getDiag(strippedBody, true), { stack: stackTrace, @@ -201,26 +201,24 @@ tap.test('preserves stack trace for failed assertions', function (tt) { stream.pipe(concat(function (body) { var strippedBody = stripAt(body.toString('utf8')); - tt.equal( - strippedBody, - 'TAP version 13\n' - + '# t.equal stack trace\n' - + 'not ok 1 true should be false\n' - + ' ---\n' - + ' operator: equal\n' - + ' expected: false\n' - + ' actual: true\n' - + ' stack: |-\n' - + ' ' - + stack.replace(/\n/g, '\n ') - + '\n' - + ' ...\n' - + '\n' - + '1..1\n' - + '# tests 1\n' - + '# pass 0\n' - + '# fail 1\n' - ); + tt.deepEqual(strippedBody.split('\n'), [].concat( + 'TAP version 13', + '# t.equal stack trace', + 'not ok 1 true should be false', + ' ---', + ' operator: equal', + ' expected: false', + ' actual: true', + ' stack: |-', + ('\n' + stack).replace(/\n/g, '\n ').split('\n').slice(1), + ' ...', + '', + '1..1', + '# tests 1', + '# pass 0', + '# fail 1', + '' + )); tt.deepEqual(getDiag(strippedBody, true), { stack: stack, @@ -266,26 +264,24 @@ tap.test('preserves stack trace for failed assertions where actual===falsy', fun stream.pipe(concat(function (body) { var strippedBody = stripAt(body.toString('utf8')); - tt.equal( - strippedBody, - 'TAP version 13\n' - + '# t.equal stack trace\n' - + 'not ok 1 false should be true\n' - + ' ---\n' - + ' operator: equal\n' - + ' expected: true\n' - + ' actual: false\n' - + ' stack: |-\n' - + ' ' - + stack.replace(/\n/g, '\n ') - + '\n' - + ' ...\n' - + '\n' - + '1..1\n' - + '# tests 1\n' - + '# pass 0\n' - + '# fail 1\n' - ); + tt.deepEqual(strippedBody.split('\n'), [].concat( + 'TAP version 13', + '# t.equal stack trace', + 'not ok 1 false should be true', + ' ---', + ' operator: equal', + ' expected: true', + ' actual: false', + ' stack: |-', + ('\n' + stack).replace(/\n/g, '\n ').split('\n').slice(1), + ' ...', + '', + '1..1', + '# tests 1', + '# pass 0', + '# fail 1', + '' + )); tt.deepEqual(getDiag(strippedBody, true), { stack: stack, From 1645abbf47df2a8142514302da2730c54b993b47 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Wed, 4 May 2022 22:37:36 -0700 Subject: [PATCH 09/11] [meta] use `npmignore` to autogenerate an npmignore file --- .gitignore | 2 ++ .npmignore | 13 ------------- package.json | 9 ++++++++- 3 files changed, 10 insertions(+), 14 deletions(-) delete mode 100644 .npmignore diff --git a/.gitignore b/.gitignore index 1e3b179d..a63afe6d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ package-lock.json # coverage data coverage/ .nyc_output/ + +.npmignore diff --git a/.npmignore b/.npmignore deleted file mode 100644 index f156b8d7..00000000 --- a/.npmignore +++ /dev/null @@ -1,13 +0,0 @@ -# gitignore - -/node_modules - -# Only apps should have lockfiles -yarn.lock -package-lock.json - -# coverage data -coverage/ -.nyc_output/ - -.github/workflows diff --git a/package.json b/package.json index eb4ac383..58b49a06 100644 --- a/package.json +++ b/package.json @@ -40,11 +40,13 @@ "falafel": "^2.2.5", "js-yaml": "^3.14.0", "npm-run-posix-or-windows": "^2.0.2", + "npmignore": "^0.3.0", "safe-publish-latest": "^2.0.0", "tap": "^8.0.1", "tap-parser": "^3.0.5" }, "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", "prepublishOnly": "safe-publish-latest", "prepublish": "!(type not-in-publish) || not-in-publish || npm run prepublishOnly", "prelint:files": "git ls-files 2>/dev/null | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git' || echo '*.md *.js test/*.js'", @@ -86,5 +88,10 @@ "funding": { "url": "https://github.com/sponsors/ljharb" }, - "license": "MIT" + "license": "MIT", + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } } From b467b850f169bf294851c68a5c4074360d53a31b Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Mon, 19 Sep 2022 13:18:49 -0700 Subject: [PATCH 10/11] [meta] add `auto-changelog` --- CHANGELOG.md | 1752 ++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 11 + 2 files changed, 1763 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..44c1bcb5 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,1752 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v5.6.0](https://github.com/ljharb/tape/compare/v5.5.3...v5.6.0) - 2022-08-16 + +### Commits + +- [Tests] handle a broken error `cause` in node 16.9/16.10 [`53d9e18`](https://github.com/ljharb/tape/commit/53d9e18a93addb2bf70c33cc4ffe8285233a3ad0) +- [meta] use `npmignore` to autogenerate an npmignore file [`12cc602`](https://github.com/ljharb/tape/commit/12cc602f5296b023f5e226c946192e5aea453252) +- [New] `bin/tape`: include the exact arg when there are no glob results; use require.resolve on `--require` files [`e23ec12`](https://github.com/ljharb/tape/commit/e23ec12ac6bcee670ee0a507caf32512d33a9175) +- [meta] create FUNDING.yml [`f7e3161`](https://github.com/ljharb/tape/commit/f7e316175394aa72e202cf6ebfa0b3ebb0a51f60) +- [Robustness] `test` observably looks up `exec` on the object [`9dbe9ad`](https://github.com/ljharb/tape/commit/9dbe9ad9163835edb302505dec26a8e21f20d893) +- [meta] remove unused travis.yml file [`5a52443`](https://github.com/ljharb/tape/commit/5a52443dcb8c14a9b59523fbb1c05b139833c812) +- [Deps] update `glob`, `object-inspect`, `object.assign` [`f6f39a2`](https://github.com/ljharb/tape/commit/f6f39a2d8a59ab518e2647a9a122c361d2a7f4ff) +- [Dev Deps] update `@ljharb/eslint-config`, `array.prototype.flatmap`, `es-value-fixtures` [`6bc8c38`](https://github.com/ljharb/tape/commit/6bc8c381ab9117eb504ac3d46973a27619ea9b52) +- [meta] ensure `prelint` works on windows [`48896e8`](https://github.com/ljharb/tape/commit/48896e87cee94d8d704ff2fb2bf730c1c0a94c71) +- [Tests] fix no_only tests on Windows [`3e7b2ae`](https://github.com/ljharb/tape/commit/3e7b2ae9800964cf8461ab8dc10634d0c1b1218a) +- [Robustness] `test` observably looks up `exec` on the object [`330f8d5`](https://github.com/ljharb/tape/commit/330f8d586f94a8a0092b9b2061953ff9ba918325) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`3960ccf`](https://github.com/ljharb/tape/commit/3960ccf83722a25131522e35de63b89564eac519) +- [meta] add SECURITY.md [`7d31894`](https://github.com/ljharb/tape/commit/7d31894d5ad6b85567573dd875228e8e13bfac20) +- [meta] improve `prelint` script when no `.git` dir is present [`7c6dbbd`](https://github.com/ljharb/tape/commit/7c6dbbdba1769bcb80b103d43c3eaa61e395dc52) +- [Dev Deps] update `es-value-fixtures` [`6b8e118`](https://github.com/ljharb/tape/commit/6b8e118b19ff08d54509f54aab5fad3b25260e2b) +- [Fix] in node v0.4, `stream.pipe` returns `undefined` [`83d4da8`](https://github.com/ljharb/tape/commit/83d4da8ed49acd1c0478a551bc64f05a67c44e99) +- [Deps] update `string.prototype.trim` [`1a245c6`](https://github.com/ljharb/tape/commit/1a245c6b690ab7e2db346c3caf1c34eab8db456c) +- Merge tag 'v4.15.1' [`b2d547a`](https://github.com/ljharb/tape/commit/b2d547a1b06653a5cff22a8113da0f5dd392470b) +- [Deps] update `minimist` [`64677e0`](https://github.com/ljharb/tape/commit/64677e06006e1a1e4e36dc318cc4a36b2152ed95) + +## [v5.5.3](https://github.com/ljharb/tape/compare/v5.5.2...v5.5.3) - 2022-04-08 + +### Commits + +- [Robustness] `test` observably looks up `exec` on the object [`fa84c85`](https://github.com/ljharb/tape/commit/fa84c856e5f7c41d438050c5af36141899028850) +- [meta] ensure `prelint` works on windows [`bf34f60`](https://github.com/ljharb/tape/commit/bf34f600cc985c1ac21c42ce162b432751158b1e) +- [meta] improve `prelint` script when no `.git` dir is present [`5f78134`](https://github.com/ljharb/tape/commit/5f781346aa7cd7eb6a14b532304787cbc7287b9c) +- [Deps] update `minimist` [`dabc6af`](https://github.com/ljharb/tape/commit/dabc6af8cd4dd00788725b38f9829fe2a6954b27) + +## [v5.5.2](https://github.com/ljharb/tape/compare/v5.5.1...v5.5.2) - 2022-02-12 + +### Commits + +- [Dev Deps] update `@ljharb/eslint-config`; pin `eslint` [`99e7504`](https://github.com/ljharb/tape/commit/99e75043ef73031e0e352f611ed1ae9297743af4) +- [Deps] unpin `minimatch` [`c18a68b`](https://github.com/ljharb/tape/commit/c18a68bacf0f9794b9b3a89312c9d874014b7e22) + +## [v5.5.1](https://github.com/ljharb/tape/compare/v5.5.0...v5.5.1) - 2022-02-10 + +### Commits + +- [Fix] pin `minimatch` to v3.0.4, due to a breaking change in v3.0.5 [`cbe0e40`](https://github.com/ljharb/tape/commit/cbe0e408ad4ea0d2c538cd122470ab76357e64b0) + +## [v5.5.0](https://github.com/ljharb/tape/compare/v5.4.1...v5.5.0) - 2022-01-26 + +### Merged + +- [New] add `--no-only` flag/`NODE_TAPE_NO_ONLY_TEST` [`#572`](https://github.com/ljharb/tape/pull/572) + +### Commits + +- Merge tag 'v4.15.0' [`a5a1434`](https://github.com/ljharb/tape/commit/a5a14344f4f06518c2fe599b49a92633777986cc) +- [New] `t.match`/`t.doesNotMatch: fail the test instead of throw on wrong input types. [`a1c266b`](https://github.com/ljharb/tape/commit/a1c266bf9577420702e1067c40a4a65677add63a) +- [actions] reuse common workflows [`d3b4f46`](https://github.com/ljharb/tape/commit/d3b4f467445bb6da3a2e617c4b29e71528f32425) +- [readme] port changes from v5 [`87f9b29`](https://github.com/ljharb/tape/commit/87f9b293baeb48b507a4e9e16bba62c7ffcc4eb7) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud` [`51ae645`](https://github.com/ljharb/tape/commit/51ae645c8325d6037d4389260a442e27c2efce73) +- [Fix] `bin/tape`: delay requires until needed [`b803fd8`](https://github.com/ljharb/tape/commit/b803fd8e24b1dff96cd43092e727826873c6c571) +- [readme] hard wraps bad, soft wraps good [`82af5ed`](https://github.com/ljharb/tape/commit/82af5ed68577c15526e5dc7ecd290f2e88494170) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `array.prototype.flatmap` [`3287a68`](https://github.com/ljharb/tape/commit/3287a68eb1f176a6d0d85390b79c05ffc3c50615) +- [actions] update codecov uploader [`8d6aa6c`](https://github.com/ljharb/tape/commit/8d6aa6c4b084a8cec9860d868ac353862fc8b545) +- [Tests] handle carriage returns in stack traces on Windows [`f79acdf`](https://github.com/ljharb/tape/commit/f79acdfb850d94f71a01970bff96337f52bb4e5a) +- [Deps] update `glob`, `is-regex`, `string.prototype.trim` [`470ca1c`](https://github.com/ljharb/tape/commit/470ca1c0f41155d2c08537bb6cc94e04edd063bc) +- [Tests] handle a broken error `cause` in node 16.9/16.10 [`8594f3b`](https://github.com/ljharb/tape/commit/8594f3be12203e52b334a7004bf59379fb21db4f) +- [meta] better `eccheck` command [`fe6978d`](https://github.com/ljharb/tape/commit/fe6978d0a87a881a59ba7de23f2e68ff70d31074) +- [Deps] update `object-inspect`, `resolve` [`50ea080`](https://github.com/ljharb/tape/commit/50ea080561a71d8a6a2d41955441c8a094039227) +- [meta] Exclude `fs` from browser bundles (#565) [`418dc94`](https://github.com/ljharb/tape/commit/418dc94b14b440568fb58aa666df5cb2861fe22c) +- [Dev Deps] update `eslint` [`b0c8ed3`](https://github.com/ljharb/tape/commit/b0c8ed34dea1f53ac95037706746a8d3fe1ee771) +- [Tests] handle a broken error `cause` in node 16.9/16.10 [`ca1b906`](https://github.com/ljharb/tape/commit/ca1b90616c2a8fb838b1bd99c90da758c5d80a72) +- [meta] fix `prelint` so it does not fail outside of a git repo [`a09133e`](https://github.com/ljharb/tape/commit/a09133e71d3925bf830f721d05bad72550dd3517) +- [meta] fix `prelint` so it does not fail outside of a git repo [`b9959f8`](https://github.com/ljharb/tape/commit/b9959f8c132874eff32497b9189d0a7cf74e8c14) +- [Robustness] use cached `.test` [`86ec0b2`](https://github.com/ljharb/tape/commit/86ec0b262e0405ef0616201c1ffebbc5f278a217) + +## [v5.4.1](https://github.com/ljharb/tape/compare/v5.4.0...v5.4.1) - 2022-01-15 + +### Commits + +- [Fix] avoid failing in ES3 engines that lack `Object.keys`, and `.every` [`dfc5f39`](https://github.com/ljharb/tape/commit/dfc5f3927a224b03ad24a1653f1a4a1e13145014) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud` [`61446b9`](https://github.com/ljharb/tape/commit/61446b90ebff6157e84adb6c611944e26838397f) +- [Robustness] use cached `.test` [`096a9e0`](https://github.com/ljharb/tape/commit/096a9e001bdffbad37a785166ccbf9b35bcc9faa) +- [meta] better `eccheck` command [`bc4666b`](https://github.com/ljharb/tape/commit/bc4666b0deeea3b1814d2d43f1d01cf9068ac164) + +## [v5.4.0](https://github.com/ljharb/tape/compare/v5.3.2...v5.4.0) - 2021-12-25 + +### Commits + +- [New] `t.match`/`t.doesNotMatch: fail the test instead of throw on wrong input types. [`329bbb8`](https://github.com/ljharb/tape/commit/329bbb870d8862152b1bf580475a44c501dc0703) +- [actions] reuse common workflows [`728e190`](https://github.com/ljharb/tape/commit/728e190a9c9f1850a984a50c3348c2efb2f78b17) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`dc7df0f`](https://github.com/ljharb/tape/commit/dc7df0fb2393c9ee7448ffde62c4b9836a03d1e1) +- [Deps] update `has-dynamic-import`, `object-inspect` [`8881fea`](https://github.com/ljharb/tape/commit/8881fea42a60bbee5fd912def59021e76741a613) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`4023f25`](https://github.com/ljharb/tape/commit/4023f25ae22828829c5948f2c62af25fee456fea) + +## [v5.3.2](https://github.com/ljharb/tape/compare/v5.3.1...v5.3.2) - 2021-11-15 + +### Fixed + +- [Tests] handle v8 6.9 changing an error message [`#562`](https://github.com/ljharb/tape/issues/562) + +### Commits + +- [readme] hard wraps bad, soft wraps good [`b445a2b`](https://github.com/ljharb/tape/commit/b445a2bc9a0d5bd3db8f1c5fdde21163e3129701) +- [readme] add badges [`4c8d00a`](https://github.com/ljharb/tape/commit/4c8d00a81323a45c290f8d0e2a8389856ded5be6) +- [actions] update codecov uploader [`f040c4f`](https://github.com/ljharb/tape/commit/f040c4fcb0fac257d27a6cb2733f8f39a5d3d051) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest` [`459a1c5`](https://github.com/ljharb/tape/commit/459a1c5093db6a2cbf57e815d5b85d4e23511958) +- [Tests] node 17+ smooshes a version number on the end of the stack trace [`e41763f`](https://github.com/ljharb/tape/commit/e41763f8315d92d0d5bcd13f397f7d2f78f69745) +- [Tests] handle carriage returns in stack traces on Windows [`26e8113`](https://github.com/ljharb/tape/commit/26e81135e03a808aa917bdad3d32f1ee71b2ea44) +- [Fix] use `file://` URLs for dynamic `import()` [`d487add`](https://github.com/ljharb/tape/commit/d487addb1ae69064267efc58536186229c73ea41) +- [Dev Deps] ping `signal-exit` to v3.0.3 due to https://github.com/tapjs/signal-exit/issues/66 [`3c30a55`](https://github.com/ljharb/tape/commit/3c30a555a59e5d64875116136d14fe217e59be73) +- [meta] Exclude `fs` from browser bundles [`00f21ea`](https://github.com/ljharb/tape/commit/00f21eaa14eb3d3dc70fbf518252a6f18aa7b22c) +- [Dev Deps] update `@ljharb/eslint-config` [`c837b02`](https://github.com/ljharb/tape/commit/c837b02016e240b93ae7ef40c21f4df82e7a80f9) +- [Deps] update `string.prototype.trim` [`c1248d7`](https://github.com/ljharb/tape/commit/c1248d7e434e6a4b3c61fa7b62e1f5badfa3d162) +- [Dev Deps] update `array.prototype.flatmap` [`97384b1`](https://github.com/ljharb/tape/commit/97384b10477e3112e0aefee7957204e1c7a9db57) +- [readme] fix markdown; github still has a rendering bug [`a33b5f9`](https://github.com/ljharb/tape/commit/a33b5f9b5b0a00a031d06155224f4bca6d9769af) +- [Deps] update `glob` [`477bb4c`](https://github.com/ljharb/tape/commit/477bb4c62c071889fde563e2bd133da02aa91b0b) +- Revert "[Dev Deps] ping `signal-exit` to v3.0.3 due to https://github.com/tapjs/signal-exit/issues/66" [`60bbd83`](https://github.com/ljharb/tape/commit/60bbd83ff1a342059a4ec894132ba20583a486f2) + +## [v5.3.1](https://github.com/ljharb/tape/compare/v5.3.0...v5.3.1) - 2021-08-06 + +### Merged + +- [New] add `.teardown()` on `t` instances [`#546`](https://github.com/ljharb/tape/pull/546) +- [readme] add `tape-describe` to 'other' section [`#523`](https://github.com/ljharb/tape/pull/523) + +### Fixed + +- [New] add `.teardown()` on `t` instances (#546) [`#531`](https://github.com/ljharb/tape/issues/531) +- [readme] add `tape-describe` to 'other' section (#523) [`#522`](https://github.com/ljharb/tape/issues/522) + +### Commits + +- [Tests] make `stripFullStack` output an array of lines, for better failure messages [`f299759`](https://github.com/ljharb/tape/commit/f2997591a038fa48239f205e40eed5c75278a261) +- [eslint] fully enable `@ljharb` eslint config [`836610d`](https://github.com/ljharb/tape/commit/836610d9772b91a8d31f311834ae1325f2f740bf) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`46aff81`](https://github.com/ljharb/tape/commit/46aff81f10ad63990f6047c0bdba3be0c90bd3dd) +- [readme] improve `t.throws` documentation [`b36f816`](https://github.com/ljharb/tape/commit/b36f81698fbf4d172a49abb75b9474c4a978df5c) +- [Fix] `bin/tape`: delay requires until needed [`c8f3ce3`](https://github.com/ljharb/tape/commit/c8f3ce32c73e092940e29dc72f0abba3b6529936) +- [Refactor] avoid reassigning arguments [`5c4052f`](https://github.com/ljharb/tape/commit/5c4052fcf51479320c9482c425a66dcbcc4a509a) +- [Tests] add test case for #519 for test.comment() in createStream/objectMode context [`1700642`](https://github.com/ljharb/tape/commit/17006422fa8189a7e361edfb1e803b73a72b4894) +- [Refactor] use `call-bind/callBound` instead of `function-bind` directly [`967b73f`](https://github.com/ljharb/tape/commit/967b73fe882e9c95c0436e6ce93f24fa3a2e14a9) +- [readme] Another way to create custom reporters [`d81f9f6`](https://github.com/ljharb/tape/commit/d81f9f6681ae72d3425b91e2f7a294e6d4225675) +- [meta] do not publish github action workflow files [`6bb3496`](https://github.com/ljharb/tape/commit/6bb34964abb1e704fe3dcc9fcf8d27d16ff5e296) +- [Refactor] remove unused line, unneeded var initialization; add missing `new` [`da0cdf1`](https://github.com/ljharb/tape/commit/da0cdf1651fec20f66a6bed2d1b17944e18dcd48) +- [Refactor] remove use of legacy `exports` [`a04439c`](https://github.com/ljharb/tape/commit/a04439c3027f3dc0dac8cf8ef5d24a493366be6a) +- [Deps] update `glob`, `is-regex`, `object-inspect`, `resolve`, `string.prototype.trim` [`6e71e6e`](https://github.com/ljharb/tape/commit/6e71e6ea1e009a62546a401a35974ca867a24b9a) +- [eslint] remove useless regex escapes [`1515ff4`](https://github.com/ljharb/tape/commit/1515ff4a8f749aa6d075bffdcda543ca94c559a9) +- [readme] remove travis badge; add actions and codecov badges [`57a7cc9`](https://github.com/ljharb/tape/commit/57a7cc906ec4f24f503350580c5859e5b3e56805) +- [meta] run `aud` in `posttest` [`3907aa5`](https://github.com/ljharb/tape/commit/3907aa560caa2c8d30a6a9168c0d7a3d65a3ba3e) +- [Refactor] generalize error message from calling `.end` more than once [`da8ca46`](https://github.com/ljharb/tape/commit/da8ca46cc0be28a3d4690a4009e0ddec7fc6f779) +- [Tests] handle stack differences in node 15 [`b7b01ec`](https://github.com/ljharb/tape/commit/b7b01ec38ede9f9722b5cce90574782e1eda1305) +- [Deps] update `is-regex`, `object-inspect`, `string.prototype.trim` [`e344080`](https://github.com/ljharb/tape/commit/e344080b1a4b097e1baa1a2b2e843fc283f3f5c2) +- [New] Include name of test in log when test times out (#524) [`78b4d98`](https://github.com/ljharb/tape/commit/78b4d9833a2df7593f653b263588b9a49ca3fe08) +- [Dev Deps] update `eslint` [`6d5e4ad`](https://github.com/ljharb/tape/commit/6d5e4ad3cb1f25ea03b59db4e894d51fa5b86c11) +- [Refactor] Avoid setting message property on primitives; use strict mode to catch this [`9dfb680`](https://github.com/ljharb/tape/commit/9dfb680e7543a3a701b3e410bfccbcce3b274d9f) +- [Deps] update `is-regex` [`a7ca7a3`](https://github.com/ljharb/tape/commit/a7ca7a308269bc3a250170441553d0321e0d8044) +- Merge tag 'v4.14.0' [`1f1a4a7`](https://github.com/ljharb/tape/commit/1f1a4a7c7c9ea3632074e4a008d430bbd275b231) +- [meta] add `safe-publish-latest`; use `prepublishOnly` script for npm 7+ [`c3d434d`](https://github.com/ljharb/tape/commit/c3d434d8b86a0be162efb7fb548f0405239a2688) +- [meta] ensure `not-in-publish`‘s absence does not fail anything [`2a0619d`](https://github.com/ljharb/tape/commit/2a0619d3193287aaa948fc4edf0bb2ccb4150a7b) +- [readme] remove long-dead testling-ci badge [`1461611`](https://github.com/ljharb/tape/commit/1461611bce87b190179d1ac0e2c69438f2b12f31) +- [Tests] ensure bin/tape is linted [`faa51b5`](https://github.com/ljharb/tape/commit/faa51b5baa709ba2e72f78be7cb7ce243c02a771) +- [Dev Deps] update `eslint` [`fad6165`](https://github.com/ljharb/tape/commit/fad6165ae85ebff132daedd1a1bdf3ee307c4ea1) +- [Dev Deps] update `eslint` [`79a0f4b`](https://github.com/ljharb/tape/commit/79a0f4b7b1d0c6db9228cdedf918f20a34dd7762) +- [meta] add missing `safe-publish-latest` dep [`d0a3888`](https://github.com/ljharb/tape/commit/d0a3888ee1b1481ef9ca13695414022164fbc3c2) +- [Tests] exclude examples from coverage [`283f537`](https://github.com/ljharb/tape/commit/283f537f56885d18afbc2328c0c52ee60d528332) + +## [v5.3.0](https://github.com/ljharb/tape/compare/v5.2.2...v5.3.0) - 2021-07-26 + +### Commits + +- [eslint] fully enable `@ljharb` eslint config [`9d3c5b4`](https://github.com/ljharb/tape/commit/9d3c5b4e84dbeb1272b450e74ce022cb70c56e2a) +- [New] Use import() on esm files in supported node versions [`28d6e51`](https://github.com/ljharb/tape/commit/28d6e51b9beb7252d7ad130424fdb0062425f7a0) +- [eslint] fully enable `@ljharb` eslint config [`ae8b5c0`](https://github.com/ljharb/tape/commit/ae8b5c0639be6c3b2fd0b2e132ca50ee9f760e94) +- [eslint] enable `no-shadow` [`f0756f3`](https://github.com/ljharb/tape/commit/f0756f3b12329a122498f99f6448ec8c9eafec50) +- [eslint] enable `curly`, `object-curly-spacing`, `object-curly-newline` [`e9b75e1`](https://github.com/ljharb/tape/commit/e9b75e14068359843082fd70994b19f871432a65) +- [Tests] uncaught exceptions and unhandled rejections importing files with bin/tape [`e6d2faf`](https://github.com/ljharb/tape/commit/e6d2faf67888dbb8e1262d7d083f0be7c59672cc) +- [eslint] enable `function-paren-newline`, `function-call-argument-newline` [`ae6de0c`](https://github.com/ljharb/tape/commit/ae6de0c74a288f6d8bc83f45a7a686faf09ba9b1) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`5a6de66`](https://github.com/ljharb/tape/commit/5a6de6625ab04d487d729617be83a7baf769f4f9) +- [eslint] enable `wrap-regex` [`7dcbd76`](https://github.com/ljharb/tape/commit/7dcbd7631a9ff5675f1ff0be477f0a1714b81dd3) +- [Refactor] add names to `Test.prototype` functions [`077a108`](https://github.com/ljharb/tape/commit/077a108686590363f23ba2ecf2c782016a1683e9) +- [eslint] enable `comma-spacing` [`4acf1f2`](https://github.com/ljharb/tape/commit/4acf1f292289c40c1abfb2552e09e28a9da3416a) +- [eslint] update `no-redeclare` [`b03d4c8`](https://github.com/ljharb/tape/commit/b03d4c8e722841d580a581a5d492277a7c701f94) +- [eslint] enable `brace-style` [`06eba07`](https://github.com/ljharb/tape/commit/06eba07d6b73ba2650f581372fd613f89385993c) +- [eslint] enable `no-unused-vars` [`2ebd23a`](https://github.com/ljharb/tape/commit/2ebd23a03c71d14890dc064b29526e3d523daf93) +- [eslint] enable `consistent-return` [`fb4e3cf`](https://github.com/ljharb/tape/commit/fb4e3cfc4df1f932496fbca35c013f6ad65df53b) +- [Refactor] avoid reassigning arguments [`8a0ab53`](https://github.com/ljharb/tape/commit/8a0ab5348183f1b7deabb2a87d4fb3c4dc272390) +- [eslint] enable `semi-style` [`5f8afc9`](https://github.com/ljharb/tape/commit/5f8afc997c793ca16de53aa56ac4d40b8afc8d4a) +- [readme] Another way to create custom reporters [`a68277c`](https://github.com/ljharb/tape/commit/a68277c968ff7cf6b995c2cc20ca1545642c7b4d) +- [eslint] enable `no-extra-parens` [`a08dc34`](https://github.com/ljharb/tape/commit/a08dc34371a8dc406581fb85edb591150f9c0f35) +- [eslint] enable `no-multi-spaces`, `no-multiple-empty-lines`, `space-in-parens` [`be1eb21`](https://github.com/ljharb/tape/commit/be1eb212aeeec2c229208a4702ff99af0cabb5f7) +- [Refactor] `bin/tape`: separate "preparing of files list" from "require files list" [`021fa6d`](https://github.com/ljharb/tape/commit/021fa6d22bc85f2e8f075405bcb97c6a1b87af22) +- [Refactor] remove unused line, unneeded var initialization; add missing `new` [`da45ae6`](https://github.com/ljharb/tape/commit/da45ae6b158fbbdda2cc5c2edce6e0353b65f687) +- [eslint] enable `no-lonely-if` [`771f3dd`](https://github.com/ljharb/tape/commit/771f3ddd1a3ad3a629c1d1a0780052d51143435b) +- [eslint] enable `space-infix-ops` [`233ffc6`](https://github.com/ljharb/tape/commit/233ffc623ec212b202037e03b503a6667d4deb3f) +- [Refactor] remove use of legacy `exports` [`c332d62`](https://github.com/ljharb/tape/commit/c332d629b8c5366aa81a0ea413c49c7b838128cb) +- [eslint] enable `wrap-iife` [`428636c`](https://github.com/ljharb/tape/commit/428636c047f946738ca77796599aeb32cd607072) +- [Docs] correct docs for `t.teardown` [`c4a4992`](https://github.com/ljharb/tape/commit/c4a4992cdd59d2c5ca3282bfbf2ba4c0b863eafc) +- [readme] remove travis badge; add actions and codecov badges [`900f823`](https://github.com/ljharb/tape/commit/900f823f4a0fcbf5875df387d60bfde85236faa1) +- [eslint] enable `no-extra-semi` [`1af8f52`](https://github.com/ljharb/tape/commit/1af8f529df22eb00a62474dfd6dfe5628f8f7317) +- [Deps] update `glob`, `is-regex`, `object-inspect` [`e211546`](https://github.com/ljharb/tape/commit/e2115460307cc5424392157f4e86515c54e2e819) +- [eslint] enable `no-regex-spaces` [`ef0069a`](https://github.com/ljharb/tape/commit/ef0069a9de38c89cb4b4117ffa165e7f0c6a6351) +- [Dev Deps] update `aud`, `eslint` [`00a98d3`](https://github.com/ljharb/tape/commit/00a98d3b73aad7af987cddb79b0f1e5c7d27efc2) +- [Deps] update `object-inspect` [`9bbf270`](https://github.com/ljharb/tape/commit/9bbf27083d6a63d0f61b984cf173a004583cdc35) +- [Dev Deps] update `eslint` [`57b659f`](https://github.com/ljharb/tape/commit/57b659f8324fbc63913bb41c108e1e165d5bcf07) +- [Dev Deps] update `eslint` [`e628b23`](https://github.com/ljharb/tape/commit/e628b23a35c35948d7166ac58964043d847e04eb) +- [meta] ensure `not-in-publish`‘s absence does not fail anything [`fb3a243`](https://github.com/ljharb/tape/commit/fb3a243bfe1baa4c8afb44b8c654cd98500c2e9f) +- [Deps] update `object-inspect` [`771c8c4`](https://github.com/ljharb/tape/commit/771c8c43fda1907f61b6e9fd462a4e6c747f3527) +- [meta] add `safe-publish-latest`; use `prepublishOnly` script for npm 7+ [`379115d`](https://github.com/ljharb/tape/commit/379115dc77717ff7611d156c36da5452a5b217e2) +- [Tests] exclude examples from coverage [`75decb3`](https://github.com/ljharb/tape/commit/75decb37ef2661f960adf9ff44dc76e2885d10d2) + +## [v5.2.2](https://github.com/ljharb/tape/compare/v5.2.1...v5.2.2) - 2021-03-03 + +### Commits + +- [Fix] proper exit behavior in node v0.6 [`3f94e68`](https://github.com/ljharb/tape/commit/3f94e687b976bdb324c2148d73087e769003f878) + +## [v5.2.1](https://github.com/ljharb/tape/compare/v5.2.0...v5.2.1) - 2021-02-27 + +### Fixed + +- [Fix] `t.teardown()`: ensure callback is only called once [`#551`](https://github.com/ljharb/tape/issues/551) + +### Commits + +- [Deps] update `object-is`, `string.prototype.trim` [`b497ead`](https://github.com/ljharb/tape/commit/b497ead367786cf21ddc818ee6e8f24c330b9ea0) + +## [v5.2.0](https://github.com/ljharb/tape/compare/v5.1.1...v5.2.0) - 2021-02-20 + +### Fixed + +- [New] add `.teardown()` on `t` instances [`#531`](https://github.com/ljharb/tape/issues/531) +- [readme] improve `t.throws`/`t.doesNotThrow` documentation [`#540`](https://github.com/ljharb/tape/issues/540) + +### Commits + +- [readme] improve `t.throws` documentation [`94220ba`](https://github.com/ljharb/tape/commit/94220babb105950dfc2d09d67b4731bf026449b5) +- [Tests] exclude node v0.6, for now [`3c05a87`](https://github.com/ljharb/tape/commit/3c05a873212c9dd5e773da070488f75b09a4e5f4) +- [Deps] update `is-regex`, `resolve` [`8c52d12`](https://github.com/ljharb/tape/commit/8c52d121eadee69e6b0d800e798ae7bf1f86eff9) +- [Dev Deps] update `eslint`, `aud` [`f847c85`](https://github.com/ljharb/tape/commit/f847c85167a173fcdd2365b5d6f234208a5d27a4) +- [Deps] update `call-bind` [`ce0b1ad`](https://github.com/ljharb/tape/commit/ce0b1ad6ef395bd1dba7403ea679af5284f61c0e) +- [Dev Deps] update `eslint` [`83f1eec`](https://github.com/ljharb/tape/commit/83f1eec7d51fd812fd4ceb34b20857617e42f272) + +## [v5.1.1](https://github.com/ljharb/tape/compare/v5.1.0...v5.1.1) - 2021-01-04 + +### Commits + +- [Tests] make `stripFullStack` output an array of lines, for better failure messages [`0743333`](https://github.com/ljharb/tape/commit/07433333e14fd283ceed246795863d59576d3286) +- [Tests] migrate tests to Github Actions [`266bc66`](https://github.com/ljharb/tape/commit/266bc66b0fbbda399aff42afb957ce117d9ee4b2) +- [Fix] preserve stack traces for returned Promises (async/await) [`d505cdf`](https://github.com/ljharb/tape/commit/d505cdf375bb27c0eea4b60d9da290bb11339c6a) +- [readme] Document unexpected `t.end()` behavior [`b505c4c`](https://github.com/ljharb/tape/commit/b505c4c45ff968a5cfa91bd34f80a95493936671) +- [Tests] add `timeoutAfter` test with Promises [`e8255cf`](https://github.com/ljharb/tape/commit/e8255cf46ee77626e9eef1c2909899c9508173da) +- [readme] improve method docs [`df5a124`](https://github.com/ljharb/tape/commit/df5a124e106540d77ee737127502db26db541ded) +- [Robustness] cache and call-bind more prototype methods [`8e60dcb`](https://github.com/ljharb/tape/commit/8e60dcbbb0724fb5fbaacbfb521356e6d268d42c) +- [Tests] add `npm run test:example` to test non-failing examples. [`4210e44`](https://github.com/ljharb/tape/commit/4210e442a3739969ff32075a72a49c6d95730adf) +- [eslint] fix some inconsistencies [`7ca56eb`](https://github.com/ljharb/tape/commit/7ca56ebe2c78d0286e21a589c35ae28275aa8bf7) +- [eslint] ensure no trailing commas [`04da90b`](https://github.com/ljharb/tape/commit/04da90bb387656e585bec26a325e3400cb6bd1ba) +- [meta] add Automatic Rebase and Require Allow Edits workflows [`6d72960`](https://github.com/ljharb/tape/commit/6d729605929dfa3a41607f46e0e7da8024c33976) +- [Tests] run `nyc` on all tests [`5ec21aa`](https://github.com/ljharb/tape/commit/5ec21aa2e05ca18d88924edc1be9b175fe706af1) +- [Refactor] use `call-bind/callBound` instead of `function-bind` directly [`b19da31`](https://github.com/ljharb/tape/commit/b19da31dc4d40ffccbd8bd38d3bd410fce604172) +- [meta] do not publish github action workflow files [`82c3904`](https://github.com/ljharb/tape/commit/82c3904483419fb9f36ac9a73a754d100c24e107) +- [Tests] skip Promise tests when Promises are not available [`688256a`](https://github.com/ljharb/tape/commit/688256a75340a6d088736610a77c4d9d3c580905) +- [meta] run `aud` in `posttest` [`b9bec0e`](https://github.com/ljharb/tape/commit/b9bec0e92ef2834693fc7c7e3dc779dd1baea907) +- [readme] Added tabe into reporter list [`7aff9e4`](https://github.com/ljharb/tape/commit/7aff9e4de9e70cae53b1287b03bd23d3fc22420c) + +## [v5.1.0](https://github.com/ljharb/tape/compare/v5.0.1...v5.1.0) - 2020-12-29 + +### Fixed + +- [readme] add `tape-describe` to 'other' section [`#522`](https://github.com/ljharb/tape/issues/522) + +### Commits + +- [Tests] add test case for #519 for test.comment() in createStream/objectMode context [`40ec79a`](https://github.com/ljharb/tape/commit/40ec79a125df5282bc3983771306932cf97a21b8) +- [Deps] update `deep-equal`, `object-inspect`, `object-is`, `object.assign`, `resolve`, `string.prototype.trim` [`434f615`](https://github.com/ljharb/tape/commit/434f6156cb137bd28377c98664af8e3634c1030c) +- [Deps] update `deep-equal`, `is-regex`, `object-inspect`, `object-is`, `object.assign`, `string.prototype.trim` [`df23eda`](https://github.com/ljharb/tape/commit/df23edad43112ed5d3f3aa318289a57b3540002b) +- [eslint] remove useless regex escapes [`3554d4b`](https://github.com/ljharb/tape/commit/3554d4b049f34065c6a643c5cda3d88c70a4908e) +- [readme] document Promise support; remove Promise-related alternatives [`4665d63`](https://github.com/ljharb/tape/commit/4665d6331127b23c10c0798947d9751d635dba40) +- [Tests] handle stack differences in node 15 [`1ac9ecf`](https://github.com/ljharb/tape/commit/1ac9ecf927bb1958857cb4050ec725cd3f22d27a) +- [New] Include name of test in log when test times out [`e142c29`](https://github.com/ljharb/tape/commit/e142c298e8c76c49954ede50ab59e3f2e5662d77) +- [Dev Deps] update `eslint`, `js-yaml` [`7574152`](https://github.com/ljharb/tape/commit/75741524e4715d6cf0a969bc7e987fb881a9494a) +- [Dev Deps] update `eslint` [`c6772d1`](https://github.com/ljharb/tape/commit/c6772d1fd3ca827760ca01114aec25e21751d701) +- [Dev Deps] update `eslint` [`5b7720a`](https://github.com/ljharb/tape/commit/5b7720a82f505d4c8db3d340256369564d828dc6) +- [Deps] update `resolve` [`898302b`](https://github.com/ljharb/tape/commit/898302b3e914c93b407088d36a224355b898bb0c) + +## [v5.0.1](https://github.com/ljharb/tape/compare/v5.0.0...v5.0.1) - 2020-05-24 + +### Merged + +- [Fix] `createStream`: `result` payload is not always an object [`#519`](https://github.com/ljharb/tape/pull/519) +- [Fix] Update RegExp for matching stack frames to handle Promise/then scenario [`#516`](https://github.com/ljharb/tape/pull/516) +- [Tests] Fix simple typo, placehodler -> placeholder [`#500`](https://github.com/ljharb/tape/pull/500) + +### Fixed + +- [Fix] `createStream`: `result` payload is not always an object [`#519`](https://github.com/ljharb/tape/issues/519) +- [Fix] `createStream`: `result` payload is not always an object (#519) [`#519`](https://github.com/ljharb/tape/issues/519) +- [Fix] Update RegExp for matching stack frames to handle Promise/then scenario (#516) [`#515`](https://github.com/ljharb/tape/issues/515) +- [Fix] Update RegExp for matching stack frames to handle Promise/then scenario [`#515`](https://github.com/ljharb/tape/issues/515) + +### Commits + +- Merge tag 'v4.13.3' [`b7af113`](https://github.com/ljharb/tape/commit/b7af113832ae5f3a2b379d859abf8f1513036961) +- [Dev Deps] update `eslint`, `falafel`, `js-yaml` [`9676a21`](https://github.com/ljharb/tape/commit/9676a21784a90a13e29505d86901cd1cd0c1c7db) +- [Deps] update `minimist`, `resolve` [`8887189`](https://github.com/ljharb/tape/commit/8887189c60d956f13f7b54497443bb4be2726748) +- [Dev Deps] update `eslint` [`c421eb3`](https://github.com/ljharb/tape/commit/c421eb36b4f6c3c51db329e2e2f03139ffa803af) +- [readme] add `tape-repeater` (#511) [`33712e2`](https://github.com/ljharb/tape/commit/33712e2dd7a89c6c97f58bfe38882631616363c4) +- [readme] add `tape-repeater` [`0b5804d`](https://github.com/ljharb/tape/commit/0b5804d43068602e1615dfd395a3d85949bb03da) +- [examples] add `ecstatic` [`9b87675`](https://github.com/ljharb/tape/commit/9b876753153e0a8f94894fbbe9e08d78df12b039) +- [readme] Add link to tape-player (in-process reporter) (#496) [`bc1334b`](https://github.com/ljharb/tape/commit/bc1334bc008e5d5aecd61c580aad1657932da146) +- [Docs] add an optional emoji version for tap-spec consumer (#501) [`6326dc6`](https://github.com/ljharb/tape/commit/6326dc62e761b92b87377b30c539f762ed2e9052) + +## [v5.0.0](https://github.com/ljharb/tape/compare/v5.0.0-next.5...v5.0.0) - 2020-04-24 + +### Commits + +- [Deps] update `deep-equal`, `minimist`, `object-is`, `resolve` [`6fd0691`](https://github.com/ljharb/tape/commit/6fd0691cbd5f07474f6a8e77c28468bcc8eb1d3c) +- [Breaking] remove full "lib" export; replace with explicit exports [`3bb97f1`](https://github.com/ljharb/tape/commit/3bb97f103d93603396c40472aff31f17b40d18d3) +- [Dev Deps] update `falafel` [`f24491d`](https://github.com/ljharb/tape/commit/f24491dce15696f5ca607c3d8a8a978784c8588a) +- [Tests] Fix simple typo, placehodler -> placeholder [`8ba3668`](https://github.com/ljharb/tape/commit/8ba3668c8c9acd03ddb64e5883cf996f26c8f689) +- [examples] add `ecstatic` [`d021e9d`](https://github.com/ljharb/tape/commit/d021e9d3cf037ffd65c332339cdd9d5e831dcb69) +- [readme] Add link to tape-player (in-process reporter) [`5b9c442`](https://github.com/ljharb/tape/commit/5b9c4425494d6ce9c98d9bdb8f50757caf8a2be9) +- [Docs] add an optional emoji version for tap-spec consumer [`f5d0899`](https://github.com/ljharb/tape/commit/f5d0899665c53d81a8e8dfcecce77c202f241098) + +## [v5.0.0-next.5](https://github.com/ljharb/tape/compare/v5.0.0-next.4...v5.0.0-next.5) - 2020-03-02 + +### Merged + +- [patch] Print name of test that didnt end [`#498`](https://github.com/ljharb/tape/pull/498) + +### Fixed + +- [Breaking] only `looseEqual`/`deepEqual, and their inverses, are now non-strict. [`#495`](https://github.com/ljharb/tape/issues/495) +- [Breaking] `equal`: use `==`, not `===`, to match `assert.equal` [`#495`](https://github.com/ljharb/tape/issues/495) +- [Breaking] `strictEqual`: bring `-0`/`0`, and `NaN` into line with `assert` [`#495`](https://github.com/ljharb/tape/issues/495) + +### Commits + +- [Tests] add tests for edge cases and numerics [`4526b39`](https://github.com/ljharb/tape/commit/4526b39834db8061feeeb931dcf06047f29e9970) +- [Breaking] make equality functions consistent: [`24240e2`](https://github.com/ljharb/tape/commit/24240e2b7e0f32e5db7bc46c631dd2f915e341f1) +- [Tests] sync new test cases from master [`98b2695`](https://github.com/ljharb/tape/commit/98b2695ceebf6e1e175d29f291c9c1073416d947) +- [eslint] enable `quotes` rule [`d686aa2`](https://github.com/ljharb/tape/commit/d686aa2542a3641255a5427408cf4173450b9d6e) +- [eslint] enable `quotes` rule [`1ab6bdb`](https://github.com/ljharb/tape/commit/1ab6bdbfc4fadec57ecbf99f73ba73b03e6b8046) +- [Refactor] remove unused code [`e6b6f11`](https://github.com/ljharb/tape/commit/e6b6f119720e7e7b3aa43d72cdfa384f47e76cc2) +- [Deps] update `resolve` [`398503c`](https://github.com/ljharb/tape/commit/398503cfcabbaa56aa1e79d7523815a240d2d775) +- [Deps] update `resolve` [`15ea7d1`](https://github.com/ljharb/tape/commit/15ea7d1765b32a35a6ccde4ad3ab1898a356600e) + +## [v5.0.0-next.4](https://github.com/ljharb/tape/compare/v5.0.0-next.3...v5.0.0-next.4) - 2020-01-18 + +### Fixed + +- [Fix] `match`/`doesNotMatch`: when passing, ensure the proper default assert message shows up [`#494`](https://github.com/ljharb/tape/issues/494) +- [Fix] `match`/`doesNotMatch`: when passing, ensure the proper default assert message shows up [`#494`](https://github.com/ljharb/tape/issues/494) + +### Commits + +- [Refactor] remove unused code [`cf8dccc`](https://github.com/ljharb/tape/commit/cf8dccc49511ab2c2dd6f78cf0c837de4d4fafea) +- [Deps] update `resolve` [`b30b6f1`](https://github.com/ljharb/tape/commit/b30b6f1334aab29ef0f80635de2ce2e63ce172d8) +- [Fix] `.catch` is a syntax error in older browsers [`6df4dfc`](https://github.com/ljharb/tape/commit/6df4dfc55add6a05d4b5e9cd4cdefafdda51fab4) +- Merge tag 'v4.13.1' [`925bf01`](https://github.com/ljharb/tape/commit/925bf017cdb1ba2704a14959ad03d25d2f179997) + +## [v5.0.0-next.3](https://github.com/ljharb/tape/compare/v5.0.0-next.2...v5.0.0-next.3) - 2020-01-08 + +### Commits + +- [Fix] tests without a callback that are *skipped* should not fail [`82e316b`](https://github.com/ljharb/tape/commit/82e316b5326925ec3fb898d8849294645b4a4d60) + +## [v5.0.0-next.2](https://github.com/ljharb/tape/compare/v5.0.0-next.1...v5.0.0-next.2) - 2020-01-07 + +### Commits + +- Merge tag 'v4.13.0' [`bf07cf8`](https://github.com/ljharb/tape/commit/bf07cf8fd739d48433be1cae9be75d1ac45bc4d2) +- [New] add `t.match()` and `t.doesNotMatch()`, new in `node` `v13.6` [`0330d82`](https://github.com/ljharb/tape/commit/0330d8254d361b5b47d1ca427447a2ba84f6c2b6) +- [New] add `t.match()` and `t.doesNotMatch()`, new in `node` `v13.6` [`36a30eb`](https://github.com/ljharb/tape/commit/36a30ebf119ab33f07b4c539d7fc140ba812082a) +- [New] `tape` binary: Add -i flag to ignore files from gitignore (#492) [`e0e2542`](https://github.com/ljharb/tape/commit/e0e2542240875e5dad2ba12b1edc4be3251ae571) +- [New] `tape` binary: Add -i flag to ignore files from gitignore [`a0f9350`](https://github.com/ljharb/tape/commit/a0f93506093b8ff3902db667878a6b5078ab863e) +- [lint] fix object key spacing [`d7c2fd3`](https://github.com/ljharb/tape/commit/d7c2fd37312cb81109dff7904646692cfb373cb6) +- [Tests] handle stack trace variation in node <= 0.8 [`21ac403`](https://github.com/ljharb/tape/commit/21ac4036eb99af0eb41d88f038af0d4d9623112c) +- [Deps] update `resolve` [`0f15085`](https://github.com/ljharb/tape/commit/0f15085b090ef52176564cbc2a6b7994d38173f5) +- [readme] remove long-dead testling-ci badge [`08fae38`](https://github.com/ljharb/tape/commit/08fae38fb88c7d1d6410e230b908ad3375421cb3) + +## [v5.0.0-next.1](https://github.com/ljharb/tape/compare/v5.0.0-next.0...v5.0.0-next.1) - 2020-01-01 + +### Fixed + +- [Breaking] fail any assertion after `.end()` is called [`#264`](https://github.com/ljharb/tape/issues/264) +- [Breaking] equality functions: throw when < 2 arguments are provided [`#442`](https://github.com/ljharb/tape/issues/442) +- [Breaking] use default `require.extensions` collection instead of the magic Array `['.js']` [`#137`](https://github.com/ljharb/tape/issues/137) + +### Commits + +- [Breaking] `throws`: bring into line with node’s `assert.throws` [`547dc14`](https://github.com/ljharb/tape/commit/547dc14cac4afad8d2e9dd91c5ffc617bc441eed) +- [Refactor] make everything strict mode [`11b7d85`](https://github.com/ljharb/tape/commit/11b7d850ffaa8cb679419ff4a0e314b06a3225b9) +- [lint] fix object key spacing [`85a8a7f`](https://github.com/ljharb/tape/commit/85a8a7f8c91d6395cffabb2828b867252e724af0) +- [Tests] Fail a test if its callback returns a promise that rejects [`ad75f86`](https://github.com/ljharb/tape/commit/ad75f86a325e385fc29bc81ec162580a51b9cf49) +- [Fix] error stack file path can contain parens/spaces [`9094271`](https://github.com/ljharb/tape/commit/9094271d8d3813fd18618879be3582a842c0d279) +- [Breaking] tests with no callback are failed TODO tests [`03529a9`](https://github.com/ljharb/tape/commit/03529a991c4624cc4299f6ffd62da9d1fda77a71) +- [eslint] fix remaining undeclared variables [`1a59e0b`](https://github.com/ljharb/tape/commit/1a59e0b449f448bdd8a4267e8fe435b484ae1c06) +- [Tests] improve some failure output by adding messages [`bd76254`](https://github.com/ljharb/tape/commit/bd762540a59426f6fdbdc6f5e25bd45adc27c1ee) +- [Tests] handle stack trace variation in node <= 0.8 [`bffb60c`](https://github.com/ljharb/tape/commit/bffb60c4fab03d5f1f7292d788142018d1e25f6d) +- [Breaking] add "exports" to restrict public API [`0e713a2`](https://github.com/ljharb/tape/commit/0e713a2d5fca1a2d010744477cde4911fc067f44) +- [Refactor] generalize error message from calling `.end` more than once [`8e8af01`](https://github.com/ljharb/tape/commit/8e8af01d1fdb76d89334e7e585f7a140c0b1593e) +- [Tests] ensure bin/tape is linted [`b5b40ae`](https://github.com/ljharb/tape/commit/b5b40aeac993a25243e80aa33ff18f6961ca1da1) +- [eslint] Fix leaking variable in tests [`07e13a8`](https://github.com/ljharb/tape/commit/07e13a8f05f26a75fc6a377711fe85b082e672fb) +- [Refactor] Avoid setting message property on primitives; use strict mode to catch this [`0715294`](https://github.com/ljharb/tape/commit/071529417254377da425a457b3fc1b1faa1d622d) +- Merge tag 'v4.12.1' [`a11e272`](https://github.com/ljharb/tape/commit/a11e27291b4457f816c9393abb9e9cdd2bf3ad64) +- [Deps] update `resolve` [`b765bba`](https://github.com/ljharb/tape/commit/b765bba1ea56075d5382b203b6902c8fc5f2d5a6) +- [Dev Deps] update `eslint` [`949781f`](https://github.com/ljharb/tape/commit/949781faf753d5481085f993210738e7b93b3172) + +## [v5.0.0-next.0](https://github.com/ljharb/tape/compare/v4.16.0...v5.0.0-next.0) - 2019-12-20 + +### Commits + +- [Breaking] if a test callback returns a rejected thenable, fail the test. [`f248610`](https://github.com/ljharb/tape/commit/f248610eedc9e7236e7e6a2c4a5c0d4415dcde95) +- [Breaking] `error` should not emit `expected`/`actual` diags [`f6dc34e`](https://github.com/ljharb/tape/commit/f6dc34e4531fd279cb985166bceec160929658f1) +- [Deps] update `resolve` [`dff5f1f`](https://github.com/ljharb/tape/commit/dff5f1f4b12be558bcf4b6547eaebba162afde6d) +- [Breaking] support passing in an async function for the test callback [`5f88895`](https://github.com/ljharb/tape/commit/5f8889513f68bc545768ade50a862796c92e36b0) +- [Breaking] support exceptions in async functions [`8d3f03a`](https://github.com/ljharb/tape/commit/8d3f03afede1fef1e73d3ce2ce9ff2c7c2e47319) +- [Tests] update tests for more async/await cases [`197019c`](https://github.com/ljharb/tape/commit/197019c78c0e452852806f330e573f5023eba91c) +- [meta] change dep semver prefix from ~ to ^ [`c3924d3`](https://github.com/ljharb/tape/commit/c3924d34476247e2ba0d6e0781ca89b7d25f2a2b) +- [Breaking] update `deep-equal` to v2 [`898a6e7`](https://github.com/ljharb/tape/commit/898a6e70aadff95f23eb6f7b4e7a1fd24baacc7d) + +## [v4.16.0](https://github.com/ljharb/tape/compare/v4.15.1...v4.16.0) - 2022-08-16 + +### Commits + +- [New] `bin/tape`: include the exact arg when there are no glob results; use require on `--require` files [`6a1ce43`](https://github.com/ljharb/tape/commit/6a1ce4389e8b601249c3c81b31cd60eea3e0f74a) +- [meta] create FUNDING.yml [`5b4752f`](https://github.com/ljharb/tape/commit/5b4752fe006597002918cbd3ee8a4e50f48677ca) +- [Refactor] `bin/tape`: make it a bit more functional, for easier v5 backporting [`fbdbfc9`](https://github.com/ljharb/tape/commit/fbdbfc90dd7afeba89cc3dd5e6280ed247f8b789) +- [Deps] update `glob`, `object-inspect`, `resolve`, `string.prototype.trim` [`6a3c200`](https://github.com/ljharb/tape/commit/6a3c2009e7f6052bd4423dce80bb140e234a877f) +- [Dev Deps] update `@ljharb/eslint-config`, `array.prototype.flatmap`, `es-value-fixtures`, `falafel` [`934d49b`](https://github.com/ljharb/tape/commit/934d49b1e840d3c57bd6e52a74017e06c6a55934) +- [Tests] fix no_only tests on Windows [`f35f71b`](https://github.com/ljharb/tape/commit/f35f71bd44e76eb53bedd63615e59fdc382e4d0d) +- [Robustness] `test` observably looks up `exec` on the object [`4575ca4`](https://github.com/ljharb/tape/commit/4575ca4b185cb503c93e29113b99e10f1ae4b63c) +- [meta] add SECURITY.md [`7b0c901`](https://github.com/ljharb/tape/commit/7b0c901b459b19668fcf6cc5b4b08f42978135b4) + +## [v4.15.1](https://github.com/ljharb/tape/compare/v4.15.0...v4.15.1) - 2022-04-08 + +### Commits + +- [Tests] handle a broken error `cause` in node 16.9/16.10 [`53d9e18`](https://github.com/ljharb/tape/commit/53d9e18a93addb2bf70c33cc4ffe8285233a3ad0) +- [Robustness] `test` observably looks up `exec` on the object [`9dbe9ad`](https://github.com/ljharb/tape/commit/9dbe9ad9163835edb302505dec26a8e21f20d893) +- [meta] remove unused travis.yml file [`5a52443`](https://github.com/ljharb/tape/commit/5a52443dcb8c14a9b59523fbb1c05b139833c812) +- [meta] ensure `prelint` works on windows [`48896e8`](https://github.com/ljharb/tape/commit/48896e87cee94d8d704ff2fb2bf730c1c0a94c71) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`3960ccf`](https://github.com/ljharb/tape/commit/3960ccf83722a25131522e35de63b89564eac519) +- [meta] improve `prelint` script when no `.git` dir is present [`7c6dbbd`](https://github.com/ljharb/tape/commit/7c6dbbdba1769bcb80b103d43c3eaa61e395dc52) +- [Deps] update `minimist` [`64677e0`](https://github.com/ljharb/tape/commit/64677e06006e1a1e4e36dc318cc4a36b2152ed95) + +## [v4.15.0](https://github.com/ljharb/tape/compare/v4.14.0...v4.15.0) - 2022-01-26 + +### Merged + +- [New] add `--no-only` flag/`NODE_TAPE_NO_ONLY_TEST` [`#572`](https://github.com/ljharb/tape/pull/572) + +### Commits + +- [New] `t.match`/`t.doesNotMatch: fail the test instead of throw on wrong input types. [`a1c266b`](https://github.com/ljharb/tape/commit/a1c266bf9577420702e1067c40a4a65677add63a) +- [actions] reuse common workflows [`d3b4f46`](https://github.com/ljharb/tape/commit/d3b4f467445bb6da3a2e617c4b29e71528f32425) +- [readme] port changes from v5 [`87f9b29`](https://github.com/ljharb/tape/commit/87f9b293baeb48b507a4e9e16bba62c7ffcc4eb7) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud` [`51ae645`](https://github.com/ljharb/tape/commit/51ae645c8325d6037d4389260a442e27c2efce73) +- [Fix] `bin/tape`: delay requires until needed [`b803fd8`](https://github.com/ljharb/tape/commit/b803fd8e24b1dff96cd43092e727826873c6c571) +- [readme] hard wraps bad, soft wraps good [`82af5ed`](https://github.com/ljharb/tape/commit/82af5ed68577c15526e5dc7ecd290f2e88494170) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `array.prototype.flatmap` [`3287a68`](https://github.com/ljharb/tape/commit/3287a68eb1f176a6d0d85390b79c05ffc3c50615) +- [actions] update codecov uploader [`8d6aa6c`](https://github.com/ljharb/tape/commit/8d6aa6c4b084a8cec9860d868ac353862fc8b545) +- [Tests] handle carriage returns in stack traces on Windows [`f79acdf`](https://github.com/ljharb/tape/commit/f79acdfb850d94f71a01970bff96337f52bb4e5a) +- [Deps] update `glob`, `is-regex`, `string.prototype.trim` [`470ca1c`](https://github.com/ljharb/tape/commit/470ca1c0f41155d2c08537bb6cc94e04edd063bc) +- [meta] better `eccheck` command [`fe6978d`](https://github.com/ljharb/tape/commit/fe6978d0a87a881a59ba7de23f2e68ff70d31074) +- [Deps] update `object-inspect`, `resolve` [`50ea080`](https://github.com/ljharb/tape/commit/50ea080561a71d8a6a2d41955441c8a094039227) +- [meta] Exclude `fs` from browser bundles (#565) [`418dc94`](https://github.com/ljharb/tape/commit/418dc94b14b440568fb58aa666df5cb2861fe22c) +- [Tests] handle a broken error `cause` in node 16.9/16.10 [`ca1b906`](https://github.com/ljharb/tape/commit/ca1b90616c2a8fb838b1bd99c90da758c5d80a72) +- [meta] fix `prelint` so it does not fail outside of a git repo [`a09133e`](https://github.com/ljharb/tape/commit/a09133e71d3925bf830f721d05bad72550dd3517) +- [Robustness] use cached `.test` [`86ec0b2`](https://github.com/ljharb/tape/commit/86ec0b262e0405ef0616201c1ffebbc5f278a217) + +## [v4.14.0](https://github.com/ljharb/tape/compare/v4.13.3...v4.14.0) - 2021-07-27 + +### Merged + +- [New] add `.teardown()` on `t` instances [`#546`](https://github.com/ljharb/tape/pull/546) +- [readme] add `tape-describe` to 'other' section [`#523`](https://github.com/ljharb/tape/pull/523) + +### Fixed + +- [New] add `.teardown()` on `t` instances (#546) [`#531`](https://github.com/ljharb/tape/issues/531) +- [readme] add `tape-describe` to 'other' section (#523) [`#522`](https://github.com/ljharb/tape/issues/522) + +### Commits + +- [Tests] make `stripFullStack` output an array of lines, for better failure messages [`f299759`](https://github.com/ljharb/tape/commit/f2997591a038fa48239f205e40eed5c75278a261) +- [eslint] fully enable `@ljharb` eslint config [`836610d`](https://github.com/ljharb/tape/commit/836610d9772b91a8d31f311834ae1325f2f740bf) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`46aff81`](https://github.com/ljharb/tape/commit/46aff81f10ad63990f6047c0bdba3be0c90bd3dd) +- [readme] improve `t.throws` documentation [`b36f816`](https://github.com/ljharb/tape/commit/b36f81698fbf4d172a49abb75b9474c4a978df5c) +- [Refactor] avoid reassigning arguments [`5c4052f`](https://github.com/ljharb/tape/commit/5c4052fcf51479320c9482c425a66dcbcc4a509a) +- [Tests] add test case for #519 for test.comment() in createStream/objectMode context [`1700642`](https://github.com/ljharb/tape/commit/17006422fa8189a7e361edfb1e803b73a72b4894) +- [Refactor] use `call-bind/callBound` instead of `function-bind` directly [`967b73f`](https://github.com/ljharb/tape/commit/967b73fe882e9c95c0436e6ce93f24fa3a2e14a9) +- [readme] Another way to create custom reporters [`d81f9f6`](https://github.com/ljharb/tape/commit/d81f9f6681ae72d3425b91e2f7a294e6d4225675) +- [meta] do not publish github action workflow files [`6bb3496`](https://github.com/ljharb/tape/commit/6bb34964abb1e704fe3dcc9fcf8d27d16ff5e296) +- [Refactor] remove unused line, unneeded var initialization; add missing `new` [`da0cdf1`](https://github.com/ljharb/tape/commit/da0cdf1651fec20f66a6bed2d1b17944e18dcd48) +- [Refactor] remove use of legacy `exports` [`a04439c`](https://github.com/ljharb/tape/commit/a04439c3027f3dc0dac8cf8ef5d24a493366be6a) +- [Deps] update `glob`, `is-regex`, `object-inspect`, `resolve`, `string.prototype.trim` [`6e71e6e`](https://github.com/ljharb/tape/commit/6e71e6ea1e009a62546a401a35974ca867a24b9a) +- [eslint] remove useless regex escapes [`1515ff4`](https://github.com/ljharb/tape/commit/1515ff4a8f749aa6d075bffdcda543ca94c559a9) +- [readme] remove travis badge; add actions and codecov badges [`57a7cc9`](https://github.com/ljharb/tape/commit/57a7cc906ec4f24f503350580c5859e5b3e56805) +- [meta] run `aud` in `posttest` [`3907aa5`](https://github.com/ljharb/tape/commit/3907aa560caa2c8d30a6a9168c0d7a3d65a3ba3e) +- [Refactor] generalize error message from calling `.end` more than once [`da8ca46`](https://github.com/ljharb/tape/commit/da8ca46cc0be28a3d4690a4009e0ddec7fc6f779) +- [Tests] handle stack differences in node 15 [`b7b01ec`](https://github.com/ljharb/tape/commit/b7b01ec38ede9f9722b5cce90574782e1eda1305) +- [Deps] update `is-regex`, `object-inspect`, `string.prototype.trim` [`e344080`](https://github.com/ljharb/tape/commit/e344080b1a4b097e1baa1a2b2e843fc283f3f5c2) +- [New] Include name of test in log when test times out (#524) [`78b4d98`](https://github.com/ljharb/tape/commit/78b4d9833a2df7593f653b263588b9a49ca3fe08) +- [Refactor] Avoid setting message property on primitives; use strict mode to catch this [`9dfb680`](https://github.com/ljharb/tape/commit/9dfb680e7543a3a701b3e410bfccbcce3b274d9f) +- [meta] add `safe-publish-latest`; use `prepublishOnly` script for npm 7+ [`c3d434d`](https://github.com/ljharb/tape/commit/c3d434d8b86a0be162efb7fb548f0405239a2688) +- [meta] ensure `not-in-publish`‘s absence does not fail anything [`2a0619d`](https://github.com/ljharb/tape/commit/2a0619d3193287aaa948fc4edf0bb2ccb4150a7b) +- [readme] remove long-dead testling-ci badge [`1461611`](https://github.com/ljharb/tape/commit/1461611bce87b190179d1ac0e2c69438f2b12f31) +- [Tests] ensure bin/tape is linted [`faa51b5`](https://github.com/ljharb/tape/commit/faa51b5baa709ba2e72f78be7cb7ce243c02a771) +- [Dev Deps] update `eslint` [`fad6165`](https://github.com/ljharb/tape/commit/fad6165ae85ebff132daedd1a1bdf3ee307c4ea1) +- [Dev Deps] update `eslint` [`79a0f4b`](https://github.com/ljharb/tape/commit/79a0f4b7b1d0c6db9228cdedf918f20a34dd7762) +- [Tests] exclude examples from coverage [`283f537`](https://github.com/ljharb/tape/commit/283f537f56885d18afbc2328c0c52ee60d528332) + +## [v4.13.3](https://github.com/ljharb/tape/compare/v4.13.2...v4.13.3) - 2020-05-24 + +### Merged + +- [Fix] `createStream`: `result` payload is not always an object [`#519`](https://github.com/ljharb/tape/pull/519) +- [Fix] Update RegExp for matching stack frames to handle Promise/then scenario [`#516`](https://github.com/ljharb/tape/pull/516) +- [Tests] Fix simple typo, placehodler -> placeholder [`#500`](https://github.com/ljharb/tape/pull/500) + +### Fixed + +- [Fix] `createStream`: `result` payload is not always an object (#519) [`#519`](https://github.com/ljharb/tape/issues/519) +- [Fix] Update RegExp for matching stack frames to handle Promise/then scenario (#516) [`#515`](https://github.com/ljharb/tape/issues/515) + +### Commits + +- [Dev Deps] update `eslint`, `falafel`, `js-yaml` [`9676a21`](https://github.com/ljharb/tape/commit/9676a21784a90a13e29505d86901cd1cd0c1c7db) +- [Deps] update `minimist`, `resolve` [`8887189`](https://github.com/ljharb/tape/commit/8887189c60d956f13f7b54497443bb4be2726748) +- [readme] add `tape-repeater` (#511) [`33712e2`](https://github.com/ljharb/tape/commit/33712e2dd7a89c6c97f58bfe38882631616363c4) +- [examples] add `ecstatic` [`9b87675`](https://github.com/ljharb/tape/commit/9b876753153e0a8f94894fbbe9e08d78df12b039) +- [readme] Add link to tape-player (in-process reporter) (#496) [`bc1334b`](https://github.com/ljharb/tape/commit/bc1334bc008e5d5aecd61c580aad1657932da146) +- [Docs] add an optional emoji version for tap-spec consumer (#501) [`6326dc6`](https://github.com/ljharb/tape/commit/6326dc62e761b92b87377b30c539f762ed2e9052) + +## [v4.13.2](https://github.com/ljharb/tape/compare/v4.13.1...v4.13.2) - 2020-03-02 + +### Merged + +- [patch] Print name of test that didnt end [`#498`](https://github.com/ljharb/tape/pull/498) + +### Commits + +- [Tests] add tests for edge cases and numerics [`4526b39`](https://github.com/ljharb/tape/commit/4526b39834db8061feeeb931dcf06047f29e9970) +- [Tests] sync new test cases from master [`98b2695`](https://github.com/ljharb/tape/commit/98b2695ceebf6e1e175d29f291c9c1073416d947) +- [eslint] enable `quotes` rule [`d686aa2`](https://github.com/ljharb/tape/commit/d686aa2542a3641255a5427408cf4173450b9d6e) +- [Refactor] remove unused code [`e6b6f11`](https://github.com/ljharb/tape/commit/e6b6f119720e7e7b3aa43d72cdfa384f47e76cc2) +- [Deps] update `resolve` [`398503c`](https://github.com/ljharb/tape/commit/398503cfcabbaa56aa1e79d7523815a240d2d775) + +## [v4.13.1](https://github.com/ljharb/tape/compare/v4.13.0...v4.13.1) - 2020-01-09 + +### Fixed + +- [Fix] `match`/`doesNotMatch`: when passing, ensure the proper default assert message shows up [`#494`](https://github.com/ljharb/tape/issues/494) + +## [v4.13.0](https://github.com/ljharb/tape/compare/v4.12.1...v4.13.0) - 2020-01-07 + +### Commits + +- [New] add `t.match()` and `t.doesNotMatch()`, new in `node` `v13.6` [`0330d82`](https://github.com/ljharb/tape/commit/0330d8254d361b5b47d1ca427447a2ba84f6c2b6) +- [New] `tape` binary: Add -i flag to ignore files from gitignore (#492) [`e0e2542`](https://github.com/ljharb/tape/commit/e0e2542240875e5dad2ba12b1edc4be3251ae571) +- [lint] fix object key spacing [`d7c2fd3`](https://github.com/ljharb/tape/commit/d7c2fd37312cb81109dff7904646692cfb373cb6) +- [Tests] handle stack trace variation in node <= 0.8 [`21ac403`](https://github.com/ljharb/tape/commit/21ac4036eb99af0eb41d88f038af0d4d9623112c) +- [Deps] update `resolve` [`0f15085`](https://github.com/ljharb/tape/commit/0f15085b090ef52176564cbc2a6b7994d38173f5) + +## [v4.12.1](https://github.com/ljharb/tape/compare/v4.12.0...v4.12.1) - 2019-12-24 + +### Commits + +- [Fix] error stack file path can contain parens/spaces [`9094271`](https://github.com/ljharb/tape/commit/9094271d8d3813fd18618879be3582a842c0d279) +- [Deps] update `resolve` [`b765bba`](https://github.com/ljharb/tape/commit/b765bba1ea56075d5382b203b6902c8fc5f2d5a6) +- [Dev Deps] update `eslint` [`949781f`](https://github.com/ljharb/tape/commit/949781faf753d5481085f993210738e7b93b3172) + +## [v4.12.0](https://github.com/ljharb/tape/compare/v4.11.0...v4.12.0) - 2019-12-16 + +### Fixed + +- [New] when the error type is wrong, show the message and stack [`#479`](https://github.com/ljharb/tape/issues/479) + +### Commits + +- [Tests] use shared travis-ci configs [`f3a5925`](https://github.com/ljharb/tape/commit/f3a5925bd805e6286731f54ad49f2307ad910dd9) +- [Tests] add a test for the wrong kind of error [`44cbbf5`](https://github.com/ljharb/tape/commit/44cbbf57f343abcf1139f861090c8b200bd80d7a) +- [Deps] update `deep-equal`, `glob`, `object-inspect`, `resolve`, `string.prototype.trim` [`6e94800`](https://github.com/ljharb/tape/commit/6e94800578340a8cab9e0f357c380ab78f09b2cd) +- [Deps] update `is-regex`, `string.prototype.trim` [`3e0a341`](https://github.com/ljharb/tape/commit/3e0a341863952c57c0e7f8ea678ebc471c9c9ef6) +- [Refactor] use `is-regex` instead of `instanceof RegExp` [`8150c3b`](https://github.com/ljharb/tape/commit/8150c3bc55032b0ace9e2fd2c1cd2eeb90710840) +- [Dev Deps] update `eslint` [`ba7e2b2`](https://github.com/ljharb/tape/commit/ba7e2b218b641368eca19d91c11bd8774812416f) +- add tap-nyc to pretty-reporters [`24487cb`](https://github.com/ljharb/tape/commit/24487cb1d99d569b6324050ab58af1a2c0c43f0d) + +## [v4.11.0](https://github.com/ljharb/tape/compare/v4.10.2...v4.11.0) - 2019-06-28 + +### Commits + +- [lint] enforce consistent semicolon usage [`a5006ce`](https://github.com/ljharb/tape/commit/a5006ce7460255de659c8caac8959a1086c301f0) +- [New] Add descriptive messages for skipped asserts [`838d995`](https://github.com/ljharb/tape/commit/838d9957354eb4793b64595eff6b71fbf539d758) +- [Fix] emit skipped tests as objects [`8d5dc2f`](https://github.com/ljharb/tape/commit/8d5dc2f17611e73fe48b5eb28db97194cfba61f5) +- [Tests] add tests for 'todo' exit codes [`c6c4ace`](https://github.com/ljharb/tape/commit/c6c4aceccf52fb189732b95fd049b4e110d7868f) +- [meta] clean up license so github can detect it [`861cf55`](https://github.com/ljharb/tape/commit/861cf551175405a0c9f5c33a71d637c6b8ddede9) +- [Refactor] use `!!` over `Boolean()` [`32b5948`](https://github.com/ljharb/tape/commit/32b5948fe71be6008d9142d7303ea5a68e3010a2) +- [Deps] update `inherits`, `resolve` [`9526c2e`](https://github.com/ljharb/tape/commit/9526c2e9d7c4cd354238eb1fe9414a99e225d047) + +## [v4.10.2](https://github.com/ljharb/tape/compare/v4.10.1...v4.10.2) - 2019-05-25 + +### Fixed + +- [Refactor] Removed never-read inErrorState from index.js [`#461`](https://github.com/ljharb/tape/issues/461) + +### Commits + +- [fix] don't consider 'ok' of todo tests in exit code [`15b2dfc`](https://github.com/ljharb/tape/commit/15b2dfcc00f8ae6d94455034b2bf8ffb356e4d1d) +- Minor punctuation/highlighting improvement [`25b4a24`](https://github.com/ljharb/tape/commit/25b4a248b9bf8ced78d65f7775f9043209930078) +- [Dev Deps] update `eslint`, `js-yaml` [`9ec3a0f`](https://github.com/ljharb/tape/commit/9ec3a0faee15583d5cf79e6faeb5f7f22d11ca3a) +- [Deps] update `glob`, `resolve` [`c30e492`](https://github.com/ljharb/tape/commit/c30e49274bab975ced45031b579081bc5cf4904b) +- [meta] set save-prefix to `~` (meant for runtime deps) [`3f337d1`](https://github.com/ljharb/tape/commit/3f337d138527704a7eb02e7ac9d9a35ca35386ee) + +## [v4.10.1](https://github.com/ljharb/tape/compare/v4.10.0...v4.10.1) - 2019-02-13 + +### Fixed + +- Partial revert of #403: fbe4b951cb6c6cc4f0e9e3ae4a57b123dd82c0fb and 367b010d21c7c9814c4bc6b21d1c2a9a67596c11 [`#459`](https://github.com/ljharb/tape/issues/459) + +### Commits + +- [Refactor] consistent spacing [`34ebb4c`](https://github.com/ljharb/tape/commit/34ebb4cb444acbd51715467a4794ccd9e8cedcdb) +- [Deps] update `resolve` [`a63261e`](https://github.com/ljharb/tape/commit/a63261eb81e8cbeeef70ef49486d84dd41190375) + +## [v4.10.0](https://github.com/ljharb/tape/compare/v4.9.2...v4.10.0) - 2019-02-09 + +### Merged + +- [Fix] Ensure that non-functions passed to `throws` fail the test, just like `assert` [`#268`](https://github.com/ljharb/tape/pull/268) +- [Fix] Ensure that non-functions passed to `throws` fail the test, just like `assert` [`#268`](https://github.com/ljharb/tape/pull/268) +- [Fix] Ensure that non-functions passed to `throws` fail the test, just like `assert` [`#268`](https://github.com/ljharb/tape/pull/268) +- Fix premature end of tests (and running sibling tests) when test includes subtests [`#403`](https://github.com/ljharb/tape/pull/403) +- [Fix]: only use one test runner for results, even if multiple streams are created [`#404`](https://github.com/ljharb/tape/pull/404) + +### Fixed + +- Merge pull request #403 from nhamer/issue222 [`#222`](https://github.com/ljharb/tape/issues/222) +- Merge pull request #404 from nhamer/issue105 [`#105`](https://github.com/ljharb/tape/issues/105) +- [Test]: only use one test runner for results, even if multiple streams are created [`#105`](https://github.com/ljharb/tape/issues/105) +- [Fix] Fix premature end of tests (and running sibling tests) when test includes subtests [`#222`](https://github.com/ljharb/tape/issues/222) +- Comments should not make exit code incorrect. Fixes #92 [`#92`](https://github.com/ljharb/tape/issues/92) + +### Commits + +- Merge all orphaned tags: 'v1.1.2', 'v2.0.2', 'v2.1.1', 'v2.2.2', 'v2.3.3', 'v2.4.3', 'v2.5.1', 'v2.6.1', 'v2.7.3', 'v2.8.1', 'v2.9.1', 'v2.10.3', 'v2.11.1', 'v2.13.4', 'v2.14.0', 'v2.14.1', 'v3.6.1' [`6209882`](https://github.com/ljharb/tape/commit/6209882aaf646c787ccf72244e8ebb04a9c95556) +- [New] Implements TAP TODO directive [`5cdaf54`](https://github.com/ljharb/tape/commit/5cdaf548b9b1d19c638e937ada10d550290a07c0) +- Minor test tweaks due to output differences in v1 vs v4. [`d22b5fc`](https://github.com/ljharb/tape/commit/d22b5fc48f7053dbf3bc1f4804783a61534edf33) +- Minor test tweaks due to whitespace differences in v3 vs v4. [`7ed6651`](https://github.com/ljharb/tape/commit/7ed6651b984fa8da66e3014b93bc1beda57bee9b) +- [Refactor] Avoid adding a new observable method to the API. [`fbe4b95`](https://github.com/ljharb/tape/commit/fbe4b951cb6c6cc4f0e9e3ae4a57b123dd82c0fb) +- Minor test tweaks due to whitespace differences in v2 vs v4. [`6ce09d9`](https://github.com/ljharb/tape/commit/6ce09d9a27c00ed4cee566feb13886b61f067d90) +- [Tests] missing t.end(); avoid shadowing [`144a361`](https://github.com/ljharb/tape/commit/144a36184b8edeb8f586fd1f257bcc8ecf483476) +- [Fix] Stop createStream for creating additional test runner loops [`b494b18`](https://github.com/ljharb/tape/commit/b494b188dc4f909ec7ca085e299fefe247d7b1c0) +- hats, has module [`6ecc842`](https://github.com/ljharb/tape/commit/6ecc842e53a8c25c93323c1f1a41bd4966346041) +- [Dev Deps] update `eslint`, `js-yaml` [`9e3d25e`](https://github.com/ljharb/tape/commit/9e3d25ec41a0c29d173c6451a30ff19fb8b699ff) +- [Fix] windows: Show failure location even if driver letter is lowercase [`fb548b3`](https://github.com/ljharb/tape/commit/fb548b33bc9ec01a4f0242da3345f5f86e90e97d) +- Add missing `concat-stream` devDep [`8b3c1b7`](https://github.com/ljharb/tape/commit/8b3c1b7f76a8b7ac8165cac08105bd0ac390e867) +- [New] add alias 'notDeepEquals' to 'notDeepEqual' function [`35844e6`](https://github.com/ljharb/tape/commit/35844e6143da924b5bba5e67dd0b5914298461f2) +- [Deps] update `glob` [`82e7b26`](https://github.com/ljharb/tape/commit/82e7b266565d080a9cb3bfa7bb18be7029813b9c) +- [Docs] Add tape-promise into 'other' [`d15bc4b`](https://github.com/ljharb/tape/commit/d15bc4b693f26824c03fbd647bc4fea89a4af5e2) +- [Docs] Add an alternative ES6 tape runner [`aac3e70`](https://github.com/ljharb/tape/commit/aac3e70c29cfd6dd4ff559741a9a43abf918a741) +- better travis yml [`066542a`](https://github.com/ljharb/tape/commit/066542a8a0d7ec4e8c1f3a5aabfba6eb01abf9f9) +- do not set canEmitExit with browserify process shim [`a28db7e`](https://github.com/ljharb/tape/commit/a28db7eb238f679591d6019a1511b4ebfab8ec39) +- do not set canEmitExit with browserify process shim [`ebdbba6`](https://github.com/ljharb/tape/commit/ebdbba6cd9daabd981538646f27fa152f77c2c20) +- do not set canEmitExit with browserify process shim [`4f33ae5`](https://github.com/ljharb/tape/commit/4f33ae5f9236f9fc8a4f4f88390ae5400de821a7) +- do not set canEmitExit with browserify process shim [`0e47a93`](https://github.com/ljharb/tape/commit/0e47a9359b9e6df0d5fd7bc1d17d7d8159b5d218) +- do not set canEmitExit with browserify process shim [`ff3e84f`](https://github.com/ljharb/tape/commit/ff3e84f94f1e4b26bab4aabeee2c1f8ed1015684) +- do not set canEmitExit with browserify process shim [`7164a03`](https://github.com/ljharb/tape/commit/7164a031b828c0493175867b92e69512f9223867) +- do not set canEmitExit with browserify process shim [`40cf488`](https://github.com/ljharb/tape/commit/40cf48878991e0d66509e1f36f4c191265c77ea0) +- do not set canEmitExit with browserify process shim [`d282191`](https://github.com/ljharb/tape/commit/d282191d2657d37cfb8d8e1250dba06744b349e7) +- do not set canEmitExit with browserify process shim [`59fd1dc`](https://github.com/ljharb/tape/commit/59fd1dc6aa4e3c2c399c727b3e9324038dbf87ca) +- do not set canEmitExit with browserify process shim [`87eb6bc`](https://github.com/ljharb/tape/commit/87eb6bc455a6d931f5bf0efa0fefb5e710360e10) +- do not set canEmitExit with browserify process shim [`c9d502e`](https://github.com/ljharb/tape/commit/c9d502ec3da3971e34e4493593506c17ec466fcf) +- do not set canEmitExit with browserify process shim [`66c0a7d`](https://github.com/ljharb/tape/commit/66c0a7d6a48498ae58df7ecc75c4f3cfa39eb08e) +- gitignore node_modules [`71af8ba`](https://github.com/ljharb/tape/commit/71af8ba72437da9324e25a4606d340f4508a4ebf) +- gitignore node_modules [`3495543`](https://github.com/ljharb/tape/commit/3495543d1cdd2bab3676bf23b09cb319f0b02954) +- [Docs] link to mixed tape [`8a7567a`](https://github.com/ljharb/tape/commit/8a7567ae54a7f057f7016f76b5f7cef354e011b4) +- [Docs] Add electron-tap [`5c36aa8`](https://github.com/ljharb/tape/commit/5c36aa862b7b356cd773ae09016039d4b523f304) +- [Docs] Mention [`flip-tape`](https://github.com/pguth/flip-tape/blob/master/README.md) in the section "other". [`1693c34`](https://github.com/ljharb/tape/commit/1693c341abf44462dc0a83aed68ed976a7fc1ad5) + +## [v4.9.2](https://github.com/ljharb/tape/compare/v4.9.1...v4.9.2) - 2018-12-29 + +### Merged + +- [Docs] Clarify doesNotThrow parameters [`#450`](https://github.com/ljharb/tape/pull/450) +- Update README: convert list of tap reporters to links [`#439`](https://github.com/ljharb/tape/pull/439) + +### Fixed + +- [Fix] notEqual and notDeepEqual show "expected" value on failure [`#453`](https://github.com/ljharb/tape/issues/453) + +### Commits + +- Convert list of tap reporters to links [`4337f58`](https://github.com/ljharb/tape/commit/4337f5878dedadf430e0e4c8146f3c6a691f5cda) +- [Docs] Updated readme to make test, test.only and test.skip consistent. [`75c467e`](https://github.com/ljharb/tape/commit/75c467eff9b4beba9f9ce5bc186853495b871fdc) +- [Dev Deps] update `eslint`, `eclint` [`4b9c951`](https://github.com/ljharb/tape/commit/4b9c951b1629ccb95b42900fb953d18032844b74) +- Clarify doesNotThrow parameters [`f53e3f1`](https://github.com/ljharb/tape/commit/f53e3f14cdc5cd2f4551d0114dffb481f87a65aa) +- [readme] Change broken image to use web archive [`b1df632`](https://github.com/ljharb/tape/commit/b1df632b408418fcdcb266383c889cd2567f843b) +- [Docs] cleanup from #439 [`5f1c5a2`](https://github.com/ljharb/tape/commit/5f1c5a2f07a0aaa48b44764b32cca61566d10442) +- Adding tap-junit [`96de340`](https://github.com/ljharb/tape/commit/96de340ce96683a4789884eb83412e5f36640f19) + +## [v4.9.1](https://github.com/ljharb/tape/compare/v4.9.0...v4.9.1) - 2018-06-07 + +### Merged + +- [docs] Add tap-react-browser [`#433`](https://github.com/ljharb/tape/pull/433) + +### Commits + +- [Tests] add eclint and eslint, to enforce a consistent style [`c6f5313`](https://github.com/ljharb/tape/commit/c6f5313217bc0b553ccab9a70a195b26881b63d8) +- [fix] Fix bug in functionName regex during stack parsing [`ec4a71d`](https://github.com/ljharb/tape/commit/ec4a71d7c94a3692e5b42aa51d4a553d39fa8796) +- [Dev Deps] use ~ for dev deps; update to latest nonbreaking [`9d501ff`](https://github.com/ljharb/tape/commit/9d501ff25b20f9318cda741c88cf50d469175da5) +- [Deps] update `has`, `for-each`, `resolve`, `object-inspect` [`8a2d29b`](https://github.com/ljharb/tape/commit/8a2d29bc8adcd179ccef15a551f0df35fa3ab6c1) +- Add tap-react-browser [`6cbc53e`](https://github.com/ljharb/tape/commit/6cbc53ee1599cf54489dc66291a126d764ea68cf) +- [Dev Deps] update `js-yaml` [`73232c0`](https://github.com/ljharb/tape/commit/73232c01ef4d794c6c502e4f5a349d8fb26e2eeb) +- [Dev Deps] update `concat-stream` [`45788a5`](https://github.com/ljharb/tape/commit/45788a520f922397726958a37ab51dcaa6eb1b35) +- Fix spelling of "parameterize" [`24e0a8d`](https://github.com/ljharb/tape/commit/24e0a8d079ce9f68daf2ec0c00010facc383cca5) + +## [v4.9.0](https://github.com/ljharb/tape/compare/v4.8.0...v4.9.0) - 2018-02-18 + +### Merged + +- [New] use `process.env.NODE_TAPE_OBJECT_PRINT_DEPTH` for the default object print depth [`#420`](https://github.com/ljharb/tape/pull/420) +- Add "onFailure" listener to test harness. [`#408`](https://github.com/ljharb/tape/pull/408) +- normalize path separators in stripFullStack [`#402`](https://github.com/ljharb/tape/pull/402) +- Check added stack trace parts for filename match [`#387`](https://github.com/ljharb/tape/pull/387) +- Fix dirname in stack traces [`#388`](https://github.com/ljharb/tape/pull/388) +- Use local reference for clearTimeout global [`#385`](https://github.com/ljharb/tape/pull/385) + +### Fixed + +- [Fix] fix stack where actual is falsy [`#399`](https://github.com/ljharb/tape/issues/399) + +### Commits + +- Handle spaces in path name for setting file, line no [`bf5a750`](https://github.com/ljharb/tape/commit/bf5a750937df4920ab9e2e965be02ac69dd43f72) +- Update tests to correctly reference (or ignore) at prop [`d165142`](https://github.com/ljharb/tape/commit/d16514294623c710598a015fee233271e6bfee2c) +- Test for anonymous function wrapper [`6015599`](https://github.com/ljharb/tape/commit/601559949295fa6479d877ec5a69ef3dac419f52) +- Test name with spaces [`3c2087a`](https://github.com/ljharb/tape/commit/3c2087a214cd9f0086bc12ec1ec24b1ab02293a0) +- Add "onFinish" listener to test harness. [`00aa133`](https://github.com/ljharb/tape/commit/00aa1339b61eca78e2a4c52e22cbfdd08deef06a) +- [New] use `process.env.NODE_TAPE_OBJECT_PRINT_DEPTH` for the default object print depth. [`17276d7`](https://github.com/ljharb/tape/commit/17276d7473f9d98e37bab47ebdddf74ca1931f43) +- Handle stack variation in Node v0.8 [`a5fb7ed`](https://github.com/ljharb/tape/commit/a5fb7eda4cde3880bd07b23efb177bae11124768) +- [Tests] on `node` `v9`; use `nvm install-latest-npm` [`4919e40`](https://github.com/ljharb/tape/commit/4919e409e8a7c9d78a3abf0cea33a3549bb24fbc) +- Update existing tests to properly reference anonymous names [`f619f60`](https://github.com/ljharb/tape/commit/f619f604af08075b7c758c77924fdda8f2967704) +- Provide placeholder names for anonymous functions [`32faf70`](https://github.com/ljharb/tape/commit/32faf707e770f63071823f4a97122d7724d57aa9) +- [Deps] update `object-inspect`, `resolve` [`6867840`](https://github.com/ljharb/tape/commit/686784059075888fb6190fe790b2f873ef6b17fb) +- Reverse engineer error for at prop too [`1eba217`](https://github.com/ljharb/tape/commit/1eba217edbbdb84104ceac493062729fc3fe20fd) +- normalize path separators in stacks [`f90e487`](https://github.com/ljharb/tape/commit/f90e487aad2d787b6d725186e37bf352110dd97d) +- [Dev Deps] update `js-yaml` [`0e68b2d`](https://github.com/ljharb/tape/commit/0e68b2d1ff44929ea56c291fa24d9083e3151f84) +- [Deps] update `function-bind` [`b66f8f8`](https://github.com/ljharb/tape/commit/b66f8f80928bb82f0817407880a139ad118daf01) +- Use lib directory instead of package root for stacktrace checking [`b6f5aaf`](https://github.com/ljharb/tape/commit/b6f5aaff16144520c182ab33bd915fe14159a913) +- correct spelling mistake [`fde8216`](https://github.com/ljharb/tape/commit/fde82161a9e53cb104f94a8b41c40af00cbcaee4) + +## [v4.8.0](https://github.com/ljharb/tape/compare/v4.7.0...v4.8.0) - 2017-07-31 + +### Commits + +- [Deps] update `resolve`, `object-inspect` [`b50084c`](https://github.com/ljharb/tape/commit/b50084ccb22c2de3c51bdbdc62ae788443b10483) +- [Dev Deps] update `js-yaml` [`c82c593`](https://github.com/ljharb/tape/commit/c82c593d8cba15abfd7914f418e677ccfc23eaf6) +- updates README.md and adds tap-html [`bd6db7b`](https://github.com/ljharb/tape/commit/bd6db7b123a3a7e7c12bd2816b1840ed418a9d2a) + +## [v4.7.0](https://github.com/ljharb/tape/compare/v4.6.3...v4.7.0) - 2017-06-26 + +### Merged + +- Fix spurious "test exited without ending" [`#374`](https://github.com/ljharb/tape/pull/374) + +### Fixed + +- [Fix] fix spurious "test exited without ending" [`#223`](https://github.com/ljharb/tape/issues/223) + +### Commits + +- [New] show full error stack on failure [`9302682`](https://github.com/ljharb/tape/commit/93026823b0606021adac0042ef2da6865607ee90) +- [Cleanup] elses need cuddles [`995ddb2`](https://github.com/ljharb/tape/commit/995ddb254ab5e6048b4d049b902601b597ff24e0) +- [Tests] fix thrower stack in node 0.8 [`8b3a77e`](https://github.com/ljharb/tape/commit/8b3a77e595b8ee328d016fa12c773e9e7299910a) +- [Tests] fix stack differences on node 0.8 [`c7859a2`](https://github.com/ljharb/tape/commit/c7859a274b823823b4de1522959d2c06a1f3bd2b) +- [Tests] on `node` `v8`; no need for sudo; `v0.8` passes now; allow v5/v7/iojs to fail. [`e030260`](https://github.com/ljharb/tape/commit/e030260c86e48afd3edf8bd77bb048975f348eff) +- Only apps should have lock files. [`df48bfa`](https://github.com/ljharb/tape/commit/df48bfae19d8ba4b48055dacac8b81912b8887f2) +- [Tests] npm v4.6+ breaks on node < v1 [`35e47e1`](https://github.com/ljharb/tape/commit/35e47e1652dca17af9abfbb9050753dfe9c91ea0) +- [Refactor] instead of throwing on `undefined.forEach`, throw explicitly. [`b06f914`](https://github.com/ljharb/tape/commit/b06f9140729e61fad95daf5b765d77809b304f96) +- [Deps] update `glob`, `resolve` [`1a8e936`](https://github.com/ljharb/tape/commit/1a8e936235d8cf8269ce0683786761286a129bd8) +- [Dev Deps] update `falafel`, `js-yaml` [`7eb9e36`](https://github.com/ljharb/tape/commit/7eb9e3638743bd513bc69ae3f7db61401d68f7e5) +- [Dev Deps] update `concat-stream`, `js-yaml` [`e6d4625`](https://github.com/ljharb/tape/commit/e6d4625e175a42e3694a88a7061dc9e3f593cd37) +- [Tests] npm v5+ breaks on node < v4 [`4375661`](https://github.com/ljharb/tape/commit/4375661d4de9fb69da93e981c97f3d1eeda55871) +- [Deps] update `object-inspect` [`dc1ffa5`](https://github.com/ljharb/tape/commit/dc1ffa5c8e7486a15b785ff0f14b34ef879a8d57) +- [Deps] update `resolve` [`66519cb`](https://github.com/ljharb/tape/commit/66519cb1f018c50676b889ae8980fdd67a21de18) +- tap-min moved to derhuerst/tap-min [`bdf2b04`](https://github.com/ljharb/tape/commit/bdf2b04e8262eba2797acf7927b93f5b329ffe67) +- [Dev Deps] update `tap` [`5ec88e7`](https://github.com/ljharb/tape/commit/5ec88e736adbf85f05b7a3bb34caa452ed644e53) + +## [v4.6.3](https://github.com/ljharb/tape/compare/v4.6.2...v4.6.3) - 2016-11-21 + +### Commits + +- [Tests] on `node` `v7` [`a4cc2fe`](https://github.com/ljharb/tape/commit/a4cc2fe3e67c3c07bfcdbf244d46c9c68b29e6aa) +- [Fix] don’t assume `Array#forEach`, for ES3. [`cc9cc30`](https://github.com/ljharb/tape/commit/cc9cc304b60864d76e9a9efdd4e90003502cafff) +- [Dev Deps] update `js-yaml`, `tap-parser` [`a80e655`](https://github.com/ljharb/tape/commit/a80e655d9f03c26f1bb454927cbc8ba1f5679f2a) +- [Deps] update `glob` [`9b27d19`](https://github.com/ljharb/tape/commit/9b27d19c7de6151af356ade4876841595276d211) + +## [v4.6.2](https://github.com/ljharb/tape/compare/v4.6.1...v4.6.2) - 2016-09-30 + +### Fixed + +- [Fix] if someone throws `null`/`undefined`, it shouldn’t crash [`#324`](https://github.com/ljharb/tape/issues/324) + +## [v4.6.1](https://github.com/ljharb/tape/compare/v4.6.0...v4.6.1) - 2016-09-29 + +### Merged + +- Fix for not showing path for error messages on windows [`#316`](https://github.com/ljharb/tape/pull/316) +- [Tests] [Dev Deps] Update to latest version of devDependencies tap (v7) and tap-parser (v2) [`#318`](https://github.com/ljharb/tape/pull/318) +- [Fix] `.only` should not run multiple tests with the same name. [`#303`](https://github.com/ljharb/tape/pull/303) + +### Fixed + +- [Fix] `throws`: only reassign “message” when it is not already non-enumerable. [`#320`](https://github.com/ljharb/tape/issues/320) +- update devDpendencies to latest: tap (v7) and tap-parser (v2) fixes #312 [`#312`](https://github.com/ljharb/tape/issues/312) +- update tap & tap-parser to latest versions fixes #312 (update devDependencies) [`#312`](https://github.com/ljharb/tape/issues/312) +- Merge pull request #303 from jtlapp/ref-based-only [`#299`](https://github.com/ljharb/tape/issues/299) + +### Commits + +- update test/exit.js to use concat-stream instead of tap.createConsumer (method unvailable in tap v7) for #312 [`78e4ffd`](https://github.com/ljharb/tape/commit/78e4ffd6e5108907ed1389546e78414d88e42cc4) +- update test/require.js to use concat-stream instead of tap.createConsumer (method method unavailable in tap v7) see: https://github.com/substack/tape/issues/312#issuecomment-242740448 [`8826099`](https://github.com/ljharb/tape/commit/882609917f2a9739198e5f09c4262ab990e2964e) +- update test/end-as-callback.js to use concat-stream instead of tap.createCosumer (method unavailable in tap v7) for #312 [`be10880`](https://github.com/ljharb/tape/commit/be1088077b09d511eba5ce3704541801aa894028) +- udpate test/nested.js to use concat-stream instead of tap.createConsumer (method unavailable in tap v7) #312 [`1211a3a`](https://github.com/ljharb/tape/commit/1211a3afba139f91ae43939680565f499301dfe3) +- update test/too_many.js to use concat-stream instead of tap.createConsumer (method unavailable in tap v7) see: https://github.com/substack/tape/issues/312#issuecomment-242740448 [`5f89509`](https://github.com/ljharb/tape/commit/5f89509559176ee49db3b5ae812324a292614425) +- update test/fail.js to use concat-stream instead of tap.createConsumer (method unavailable in tap v7) see #312 [`b9ab50e`](https://github.com/ljharb/tape/commit/b9ab50ea47a72d61331d9fc55d684b3aa919d393) +- update test/array.js to use concat-stream instead of tap.createConsumer() (no longer available in tap v7) [`00e595a`](https://github.com/ljharb/tape/commit/00e595a511d0c15b7cf191c6e46ee3ea464d39ed) +- update test/nested-sync-noplan-noend.js to use concat-stream instead of tap.createConsumer (method unavailable in tap v7) for #312 [`45ae6c1`](https://github.com/ljharb/tape/commit/45ae6c106e7fa729ec9e5e475c12c9672c5a1324) +- update test/default-messages.js to use concat-stream instead of tap.createConsumer() (no longer available in tap v7) #312 [`eb30f50`](https://github.com/ljharb/tape/commit/eb30f50930eecfe49ca64a1ec41305bdca84358a) +- update test/timeoutAfter.js to use concat-stream instead of tap.createConsumer (method unavailable in tap v7) see: https://github.com/substack/tape/issues/312#issuecomment-242740448 [`db3a45e`](https://github.com/ljharb/tape/commit/db3a45eda8a855a87478e7533602fd1d8c787d17) +- update test/only.js to use concat-stream instead of tap.createConsumer (method unavailable in tap v7) for #312 [`c1807c2`](https://github.com/ljharb/tape/commit/c1807c26efc475fa8838e72891e47efcc45b1374) +- .only now identifies tests by reference instead of by test name, fixing #299 [`289b590`](https://github.com/ljharb/tape/commit/289b59005706dbedf572c9d209681656664c7bde) +- Separate tap extensions by category [`6978df4`](https://github.com/ljharb/tape/commit/6978df4fde57d2cbab517f479794cf3f4a84f482) +- In docs, clarified when 'msg' describes the assertion. Also clarified 'expected' in throws(). [`e532790`](https://github.com/ljharb/tape/commit/e532790dd690ac8936d642b1392b14cba91e2569) +- remove redundant tests from test/skip.js - still testing the documented API adequately [`aa021eb`](https://github.com/ljharb/tape/commit/aa021eb616cde1a547995ac0ffef02b73895ba04) +- remove redundant tests in test/throws.js (assertion unchanged! tests pass) for #312 [`fd7eb30`](https://github.com/ljharb/tape/commit/fd7eb30bea4328cebeaa38d9bea4c21c47f12e5e) +- Fix for unit tests on windows [`baca83c`](https://github.com/ljharb/tape/commit/baca83c59361a6fb3baf5f5e0ef967c9eb80e124) +- update test/max_listeners.js to use path.join for cross-platform compatibility see: https://github.com/substack/tape/pull/314#discussion_r76651627 [`1bac623`](https://github.com/ljharb/tape/commit/1bac623d0df9250aede8ba091e87688fa4b31b02) +- [Dev Deps] update `falafel`, `tap-parser` [`50f462e`](https://github.com/ljharb/tape/commit/50f462e7a8acd4c5cd9cdebd2a25d52ab16e49bd) +- [Dev Deps] update `tap`, `tap-parser` [`ea9dcb7`](https://github.com/ljharb/tape/commit/ea9dcb78c91c6905c2bce0bf804475d2a9d3b4df) +- update test/double_end.js to use path.join for cross-platform compatibility see: https://github.com/substack/tape/pull/314#discussion_r76651627 [`e3115ff`](https://github.com/ljharb/tape/commit/e3115ff6c23398c3a9486a51bebd41656e3d6f2e) +- [Deps] update `glob` [`6369b77`](https://github.com/ljharb/tape/commit/6369b778c15f72c4d8954527d076b3d0ede0bf74) +- [Tests] ensure the max_listeners test has passing output. [`918e217`](https://github.com/ljharb/tape/commit/918e217c03febe3f8b7c12cc5d6a133745698cd0) +- [Deps] update `inherits` [`96552cf`](https://github.com/ljharb/tape/commit/96552cff15ab5a5072b9343cf476c8d3e1e95452) +- [Dev Deps] update `concat-stream` [`47507a0`](https://github.com/ljharb/tape/commit/47507a065e7e905180a0c9883b59d87a4b4d4154) +- [Deps] update `glob` [`8608d59`](https://github.com/ljharb/tape/commit/8608d598cbcf14f575494bb1e0eeed2dd22a7f5a) +- Fix bug from #303 / 289b59005706dbedf572c9d209681656664c7bde [`092344b`](https://github.com/ljharb/tape/commit/092344b906cd3774ba1812d2db431e77916c9f19) +- initialized _only to null [`07da71b`](https://github.com/ljharb/tape/commit/07da71b3e08d4f8c07e8c6e5796c1859a4f116ce) +- [Dev Deps] update `glob` [`fb600ee`](https://github.com/ljharb/tape/commit/fb600eed777a8b4c712005eeda49b2edc0449a70) +- Added travis ci support for node 6 [`d5e1a5e`](https://github.com/ljharb/tape/commit/d5e1a5ef42ae838951bdc41a9d494c6278576d75) + +## [v4.6.0](https://github.com/ljharb/tape/compare/v4.5.1...v4.6.0) - 2016-06-19 + +### Fixed + +- [Robustness] be robust against the global `setTimeout` changing. [`#292`](https://github.com/ljharb/tape/issues/292) +- [Tests] add some tests with `throws` and RegExp matching. [`#269`](https://github.com/ljharb/tape/issues/269) + +### Commits + +- [results] make object-inspect depth configurable for expected/actual [`a196915`](https://github.com/ljharb/tape/commit/a1969156ca4ed81ffc2cc338f8d905fb65ae1604) +- add message defaults to .ok() and .notOk() [`91b639c`](https://github.com/ljharb/tape/commit/91b639c360eef0c31a7b25e788311c7bfeb981a1) +- Add test for deep loose equal. [`5060034`](https://github.com/ljharb/tape/commit/5060034b6ceae1f08bc552029bab5bbc5199f7b9) +- [Deps] update `glob`, `object-inspect` [`5492dee`](https://github.com/ljharb/tape/commit/5492dee269ee4af5bd19fd558a41badaa986641e) +- [Dev Deps] update `js-yaml` [`03bf9b6`](https://github.com/ljharb/tape/commit/03bf9b63948df5e4733559f9db091543869bbe09) +- [Deps] update `glob` [`1f82954`](https://github.com/ljharb/tape/commit/1f829546b7cfbc167d150c1594de19f6aaabca5c) +- Update readme.markdown [`7ea6373`](https://github.com/ljharb/tape/commit/7ea6373848e37efb3acc3f4898f084d96d7994ee) +- link build badge to master branch [`a2c0f2e`](https://github.com/ljharb/tape/commit/a2c0f2eff3b00c9057c243e2b57b673209d9aaf0) +- [Dev Deps] update `js-yaml` [`b194ab1`](https://github.com/ljharb/tape/commit/b194ab17670a1dfbb3f9c99a638a46dd7e9b84e7) + +## [v4.5.1](https://github.com/ljharb/tape/compare/v4.5.0...v4.5.1) - 2016-03-06 + +### Merged + +- [Fix] Ensure that non-functions passed to `throws` fail the test, just like `assert` [`#268`](https://github.com/ljharb/tape/pull/268) + +### Fixed + +- Ensure that non-functions passed to `throws` fail the test, just like `assert` [`#267`](https://github.com/ljharb/tape/issues/267) + +## [v4.5.0](https://github.com/ljharb/tape/compare/v4.4.1...v4.5.0) - 2016-03-02 + +### Merged + +- Test on Node.js v0.10.x, v0.12.x, v4.x, and v5.x [`#238`](https://github.com/ljharb/tape/pull/238) +- [Docs] Fix readme formatting [`#233`](https://github.com/ljharb/tape/pull/233) + +### Fixed + +- [Tests] remove unnecessary + failing Error message assertion [`#255`](https://github.com/ljharb/tape/issues/255) + +### Commits + +- [New] Skipped test blocks should output a “SKIP” message. [`1414948`](https://github.com/ljharb/tape/commit/1414948acaeb0a3b39e77b78a0ea94725756142c) +- [Deps] update `deep-equal`, `function-bind`, `glob`, `object-inspect`, `resolve`, `string.prototype.trim`, `through` [`13654ad`](https://github.com/ljharb/tape/commit/13654addc410056b6dd48a35352deaa167b5bb98) +- [Dev Deps] update `concat-stream`, `falafel`, `js-yaml`, `tap-parser` [`9a6b655`](https://github.com/ljharb/tape/commit/9a6b6559013ee732472b5e81bd106994121a068d) +- doc: Explain opts in t.test [`545db26`](https://github.com/ljharb/tape/commit/545db260ee27e7121eed42e963973038013b4bd4) +- [Tests] building C extensions on iojs 3 and greater doesn’t work on a stock sudoless travis-ci VM. [`40be685`](https://github.com/ljharb/tape/commit/40be68520fedee580462bfaa7e91651154a65bea) +- Fix readme formatting [`69dada1`](https://github.com/ljharb/tape/commit/69dada15d940f9925e4e9a4ff6c71039d497c2cd) +- Travis: Get rid of sudo [`95848f4`](https://github.com/ljharb/tape/commit/95848f4a361168a429c1b16dc6988f90f8a413a0) +- Add back iojs [`0f51449`](https://github.com/ljharb/tape/commit/0f5144995a3bdd4eff81f294b7b8537116856a8a) + +## [v4.4.1](https://github.com/ljharb/tape/compare/v4.4.0...v4.4.1) - 2015-12-30 + +### Merged + +- Multiline comments [`#228`](https://github.com/ljharb/tape/pull/228) +- [Docs] Fix a typo in the README [`#229`](https://github.com/ljharb/tape/pull/229) + +### Commits + +- Exploratory comments to ascertain current behavior [`cc3b58e`](https://github.com/ljharb/tape/commit/cc3b58e632f9f5344bcc3e9637ab1c019e5d2d37) +- Failing test for new functionality [`0132b1d`](https://github.com/ljharb/tape/commit/0132b1db156fae25bb40dc09ec178217a1be4d0a) +- Added test case for Windows line endings [`c66f25e`](https://github.com/ljharb/tape/commit/c66f25e32696df21a7f59153ea3e7db3480fcc4e) +- Removed unnecessary cast [`3a5417a`](https://github.com/ljharb/tape/commit/3a5417a1032287d35dad65d40c896b0bc625060f) +- Fix a typo in the README [`b8e4002`](https://github.com/ljharb/tape/commit/b8e4002d18559542af4117432d91a38e8f9ba63d) + +## [v4.4.0](https://github.com/ljharb/tape/compare/v4.3.0...v4.4.0) - 2015-12-25 + +### Merged + +- Issue175 [`#212`](https://github.com/ljharb/tape/pull/212) +- Removed unreachable Results.prototype.only code [`#217`](https://github.com/ljharb/tape/pull/217) + +### Fixed + +- rename tearDown to onFinish [`#175`](https://github.com/ljharb/tape/issues/175) +- add tape.tearDown handler [`#175`](https://github.com/ljharb/tape/issues/175) + +### Commits + +- document onFinish hook [`2795763`](https://github.com/ljharb/tape/commit/279576302ab34ed93190eddbe7778fc712adca4f) + +## [v4.3.0](https://github.com/ljharb/tape/compare/v4.2.2...v4.3.0) - 2015-12-22 + +### Merged + +- Add flag to require modules before running tests [`#224`](https://github.com/ljharb/tape/pull/224) +- Add few tap reporters [`#213`](https://github.com/ljharb/tape/pull/213) +- Add ES6 support link to documentation. [`#204`](https://github.com/ljharb/tape/pull/204) + +### Commits + +- This implements `-r` and `--require` as command line options [`7ae60f5`](https://github.com/ljharb/tape/commit/7ae60f5ff63b6bfd9c7811eb8977ed60bfeaa5ac) +- Add `-r,--require` documentation to README.md [`096d2e7`](https://github.com/ljharb/tape/commit/096d2e70bf7c73123156f6ffe3044e81adce7e1b) +- Revert "Remove unneeded whitespaces in README" [`35c6c08`](https://github.com/ljharb/tape/commit/35c6c089034add8ea6f47ef9f0d3a58e6c94dce7) +- Remove unneeded whitespaces in README [`3ed9b91`](https://github.com/ljharb/tape/commit/3ed9b91616426ac0ab5dc16274019ce70a5b3e2c) +- Use regular ol' `if` instead of boolean operator in sanity check [`ffa503a`](https://github.com/ljharb/tape/commit/ffa503ad8acb22fe3108748189c0e1888511d8ba) +- Make single require check more readable [`d0ca885`](https://github.com/ljharb/tape/commit/d0ca885a1f1e646a886aaae243c40ae03b3cc94f) +- Unquote keys in object literals [`9f02249`](https://github.com/ljharb/tape/commit/9f02249f1e99f88eae26d39527768820f9b58c89) +- Use ~ for minimist and resolve dependency versions. [`4f81dbc`](https://github.com/ljharb/tape/commit/4f81dbc5f9344b3dc9d56943d96249577d39f852) +- Fix spelling mistake in comment [`4077efe`](https://github.com/ljharb/tape/commit/4077efe19fe914a4b344ce3da1710478bed5f734) +- Fix indent mistake [`2e57f22`](https://github.com/ljharb/tape/commit/2e57f22b9690e828c42f6d3c28e22c3f01948ea7) +- Revert "Added rudimentary source map support" [`3f02033`](https://github.com/ljharb/tape/commit/3f02033f6024a526951ed6ad7606bdcb6d589f91) +- Added rudimentary source map support [`737aa42`](https://github.com/ljharb/tape/commit/737aa4273e43e5c5faa825729c4f5ecb2e3ab519) +- Add "tap-diff" and "tap-notify" to README [`77a2bbb`](https://github.com/ljharb/tape/commit/77a2bbb40397d66557bf1c7aa3cdee8b30adbd5c) + +## [v4.2.2](https://github.com/ljharb/tape/compare/v4.2.1...v4.2.2) - 2015-10-20 + +### Merged + +- Move timeout option to run time, not load time [`#202`](https://github.com/ljharb/tape/pull/202) + +## [v4.2.1](https://github.com/ljharb/tape/compare/v4.2.0...v4.2.1) - 2015-10-02 + +### Merged + +- Travis: Add Node v4 [`#195`](https://github.com/ljharb/tape/pull/195) +- add tape-dom link to the readme [`#189`](https://github.com/ljharb/tape/pull/189) + +### Commits + +- Use `string.prototype.trim` instead of relying on `String#trim`, for ES3. [`77e1848`](https://github.com/ljharb/tape/commit/77e184843f955722e261f81e50c5cc10f06784fd) +- Bumping `defined` to v1.0.0 - no implementation change, just follows semver now. [`0e407f0`](https://github.com/ljharb/tape/commit/0e407f05d66c6e29ef26989d659db99b86b40a64) +- Add Node v4 [`df62458`](https://github.com/ljharb/tape/commit/df624584d8420848bfcb340a62701dcd717867af) + +## [v4.2.0](https://github.com/ljharb/tape/compare/v4.1.0...v4.2.0) - 2015-08-14 + +### Commits + +- Use `has` instead of a homegrown version of the same. [`e82c1e8`](https://github.com/ljharb/tape/commit/e82c1e8e7a5d5ad420fc9efc8accfaa11b7dd12c) +- Use `function-bind` to ensure we're robust against modification of `Function#call` [`88d567c`](https://github.com/ljharb/tape/commit/88d567cdd9fcc0f7016029b8aa97e8439edb85c4) + +## [v4.1.0](https://github.com/ljharb/tape/compare/v4.0.3...v4.1.0) - 2015-08-12 + +### Merged + +- improve yaml formating of diagnostic information [`#171`](https://github.com/ljharb/tape/pull/171) +- Expose the main test harness [`#170`](https://github.com/ljharb/tape/pull/170) + +### Fixed + +- Expose the main harness's results object [`#148`](https://github.com/ljharb/tape/issues/148) + +### Commits + +- improve yaml formatting of diagnostic information [`b73d2bf`](https://github.com/ljharb/tape/commit/b73d2bfb69364f5332f5958bca2c69099aedc290) +- Exposing the whole test harness [`fc889f5`](https://github.com/ljharb/tape/commit/fc889f56b418fbb30150d517ed7d8b8aa5b943d4) + +## [v4.0.3](https://github.com/ljharb/tape/compare/v4.0.2...v4.0.3) - 2015-08-06 + +### Commits + +- Cache `Object.prototype.hasOwnProperty` here also. [`3eda12c`](https://github.com/ljharb/tape/commit/3eda12c110980a8348c23c0e544ab74fd1318693) + +## [v4.0.2](https://github.com/ljharb/tape/compare/v4.0.1...v4.0.2) - 2015-08-03 + +### Merged + +- Comments should not make exit code incorrect. Fixes #92 [`#168`](https://github.com/ljharb/tape/pull/168) +- Added --save-dev to install instruction [`#166`](https://github.com/ljharb/tape/pull/166) + +### Fixed + +- Merge pull request #168 from grit96/issue-92 [`#92`](https://github.com/ljharb/tape/issues/92) +- Comments should not make exit code incorrect. Fixes #92 [`#92`](https://github.com/ljharb/tape/issues/92) + +## [v4.0.1](https://github.com/ljharb/tape/compare/v4.0.0...v4.0.1) - 2015-07-19 + +### Merged + +- Add info about bin usage to readme. [`#156`](https://github.com/ljharb/tape/pull/156) +- Clarify comment documentation [`#153`](https://github.com/ljharb/tape/pull/153) + +### Commits + +- Cache `Object#hasOwnProperty` in case clients break it as part of tests [`f9a8088`](https://github.com/ljharb/tape/commit/f9a8088b93dfed09ae1a6e3be614e3e03ef8eed2) + +## [v4.0.0](https://github.com/ljharb/tape/compare/v3.6.1...v4.0.0) - 2015-04-03 + +### Fixed + +- Expand reporters section into "things that go well with tape" [`#147`](https://github.com/ljharb/tape/issues/147) +- Update dependencies [`#93`](https://github.com/ljharb/tape/issues/93) + +### Commits + +- Drop 0.8 support [`cf56a13`](https://github.com/ljharb/tape/commit/cf56a1336f90a0dcac7f5a9afa4afc09e00bfb8b) + +## [v3.6.1](https://github.com/ljharb/tape/compare/v3.6.0...v3.6.1) - 2016-03-06 + +### Merged + +- [Fix] Ensure that non-functions passed to `throws` fail the test, just like `assert` [`#268`](https://github.com/ljharb/tape/pull/268) + +### Commits + +- Minor test tweaks due to whitespace differences in v3 vs v4. [`7ed6651`](https://github.com/ljharb/tape/commit/7ed6651b984fa8da66e3014b93bc1beda57bee9b) + +## [v3.6.0](https://github.com/ljharb/tape/compare/v3.5.1...v3.6.0) - 2015-04-02 + +### Merged + +- Only check for errors in callback if exist [`#149`](https://github.com/ljharb/tape/pull/149) +- Added tap-difflet to README [`#139`](https://github.com/ljharb/tape/pull/139) +- Fixed typo in README [`#146`](https://github.com/ljharb/tape/pull/146) + +### Commits + +- fix test [`7329ddc`](https://github.com/ljharb/tape/commit/7329ddc629b44b22ef0724da846f81de7c49dab1) +- Remove this extra test I mistakenly committed [`4b1e452`](https://github.com/ljharb/tape/commit/4b1e452ea64cd4e25f91ea6155e6888dbc513382) +- Add documentation of test.comment [`04bb03e`](https://github.com/ljharb/tape/commit/04bb03eeda4e2369b1d4c277aeaf811117b5e126) +- only ifError if we have an err value [`4205104`](https://github.com/ljharb/tape/commit/4205104c47c211d1b52547d4922bdd3def8b56e4) + +## [v3.5.1](https://github.com/ljharb/tape/compare/v3.5.0...v3.5.1) - 2015-02-05 + +### Merged + +- add caught guard to avoid referencing undefined property [`#145`](https://github.com/ljharb/tape/pull/145) + +## [v3.5.0](https://github.com/ljharb/tape/compare/v3.4.0...v3.5.0) - 2015-01-30 + +### Merged + +- Detect `inErrorState` with code not equal to zero [`#138`](https://github.com/ljharb/tape/pull/138) +- Fixing backwards t.end explanation [`#142`](https://github.com/ljharb/tape/pull/142) +- adds note on t.end(arg) behavior [`#141`](https://github.com/ljharb/tape/pull/141) + +## [v3.4.0](https://github.com/ljharb/tape/compare/v3.3.0...v3.4.0) - 2015-01-18 + +### Merged + +- Add a Function.constructor check to throws. [`#130`](https://github.com/ljharb/tape/pull/130) +- remove unused require [`#131`](https://github.com/ljharb/tape/pull/131) +- Add section about uncaught exceptions to readme. [`#134`](https://github.com/ljharb/tape/pull/134) + +### Commits + +- add t.throws(fn, Function) [`13efd54`](https://github.com/ljharb/tape/commit/13efd546192dcc7fd58abdafe6f6831c9e1e269c) + +## [v3.3.0](https://github.com/ljharb/tape/compare/v3.2.0...v3.3.0) - 2015-01-18 + +### Merged + +- Improve at error detection [`#133`](https://github.com/ljharb/tape/pull/133) +- Add timeoutAfter method [`#132`](https://github.com/ljharb/tape/pull/132) + +### Commits + +- Add timeoutAfter method to Test [`926122a`](https://github.com/ljharb/tape/commit/926122a14823605b2881dbb12b35bc76904c8fa4) +- Add opts to readme [`ea6dc65`](https://github.com/ljharb/tape/commit/ea6dc65c059683b32dea8c7456bed9ad95007e59) +- Support timeout in opts [`7133ca5`](https://github.com/ljharb/tape/commit/7133ca5fdba8df304f259342468fb143c7dcd565) +- Add timeoutAfter to readme [`00a8ba8`](https://github.com/ljharb/tape/commit/00a8ba85255d9be9dc1cf6c1d00e501418dc7ea8) +- Add .gitignore [`9fb9423`](https://github.com/ljharb/tape/commit/9fb94232b211accc97f971946412e5ab0ec2eb86) + +## [v3.2.0](https://github.com/ljharb/tape/compare/v3.1.0...v3.2.0) - 2015-01-15 + +## [v3.1.0](https://github.com/ljharb/tape/compare/v3.0.3...v3.1.0) - 2015-01-15 + +### Merged + +- Remove uncaught-exception listener [`#127`](https://github.com/ljharb/tape/pull/127) +- Adding tap-xunit to reporters. [`#123`](https://github.com/ljharb/tape/pull/123) + +### Commits + +- Remove uncaught-exception. [`dd661b0`](https://github.com/ljharb/tape/commit/dd661b0b4bddce16b1d92c8d8faca10cca4bcaf6) +- Add back to do not call exit() if error semantics. [`9c60d32`](https://github.com/ljharb/tape/commit/9c60d320a58016f3f914f30eb468aa5e3a9a3c2e) +- Adding a tap-xunit to reporters. [`ca27f59`](https://github.com/ljharb/tape/commit/ca27f594ea3bc12c81a667ca019fb31a37ff7b60) + +## [v3.0.3](https://github.com/ljharb/tape/compare/v3.0.2...v3.0.3) - 2014-11-11 + +### Commits + +- notLooseEquals should be !deepEqual [`5121547`](https://github.com/ljharb/tape/commit/5121547ab28ac6b16be594772680a3364956e2d9) + +## [v3.0.2](https://github.com/ljharb/tape/compare/v3.0.1...v3.0.2) - 2014-11-05 + +### Merged + +- Change "a,b" into "actual,expected" [`#114`](https://github.com/ljharb/tape/pull/114) + +## [v3.0.1](https://github.com/ljharb/tape/compare/v3.0.0...v3.0.1) - 2014-10-17 + +### Commits + +- Fixes global leak `prop` [`9eb3ecd`](https://github.com/ljharb/tape/commit/9eb3ecd8a0637d55d120656f64ddc09c18debfac) + +## [v3.0.0](https://github.com/ljharb/tape/compare/v2.14.1...v3.0.0) - 2014-09-17 + +### Merged + +- Document that expected must be a RegExp [`#101`](https://github.com/ljharb/tape/pull/101) +- Asynchronously declared nested tests w/ plan() w/o end() [`#98`](https://github.com/ljharb/tape/pull/98) + +### Commits + +- remove failing throw test [`672b8d3`](https://github.com/ljharb/tape/commit/672b8d30f9c528c635ff273bf8e08870e4009a30) +- remove try catch [`b747374`](https://github.com/ljharb/tape/commit/b74737415c98be5e68fcd28213d86c3e32433a05) + +## [v2.14.1](https://github.com/ljharb/tape/compare/v2.14.0...v2.14.1) - 2016-03-06 + +### Merged + +- [Fix] Ensure that non-functions passed to `throws` fail the test, just like `assert` [`#268`](https://github.com/ljharb/tape/pull/268) + +### Commits + +- Minor test tweaks due to whitespace differences in v2 vs v4. [`6ce09d9`](https://github.com/ljharb/tape/commit/6ce09d9a27c00ed4cee566feb13886b61f067d90) +- gitignore node_modules [`71af8ba`](https://github.com/ljharb/tape/commit/71af8ba72437da9324e25a4606d340f4508a4ebf) + +## [v2.14.0](https://github.com/ljharb/tape/compare/v2.13.4...v2.14.0) - 2014-08-05 + +### Commits + +- hats, has module [`6ecc842`](https://github.com/ljharb/tape/commit/6ecc842e53a8c25c93323c1f1a41bd4966346041) +- better travis yml [`066542a`](https://github.com/ljharb/tape/commit/066542a8a0d7ec4e8c1f3a5aabfba6eb01abf9f9) + +## [v2.13.4](https://github.com/ljharb/tape/compare/v2.13.3...v2.13.4) - 2014-07-19 + +### Fixed + +- Comments should not make exit code incorrect. Fixes #92 [`#92`](https://github.com/ljharb/tape/issues/92) + +## [v2.13.3](https://github.com/ljharb/tape/compare/v2.13.2...v2.13.3) - 2014-06-12 + +### Merged + +- Add a section about reports to the README [`#89`](https://github.com/ljharb/tape/pull/89) + +### Commits + +- add colortape [`467ce7a`](https://github.com/ljharb/tape/commit/467ce7a19686fc61aaad9633df64319ec416d61d) + +## [v2.13.2](https://github.com/ljharb/tape/compare/v2.13.1...v2.13.2) - 2014-06-02 + +### Commits + +- FIX: handling `if (extra.parent)` when parent == 0 [`9579246`](https://github.com/ljharb/tape/commit/9579246f09a274747fefbd8b358e94774acb85be) + +## [v2.13.1](https://github.com/ljharb/tape/compare/v2.13.0...v2.13.1) - 2014-05-17 + +### Commits + +- test if fs.writeSync is defined and on windows [`b28520c`](https://github.com/ljharb/tape/commit/b28520cdd0dad25ddeaecc4660a2797b47ff42bd) +- write sync to stdout [`14ab9d1`](https://github.com/ljharb/tape/commit/14ab9d1ad38bd619a60e60269db66d724f4bd99c) +- formatting [`ffcff1e`](https://github.com/ljharb/tape/commit/ffcff1e8bce257f0d50cd99906ab96286ea50d35) + +## [v2.13.0](https://github.com/ljharb/tape/compare/v2.12.3...v2.13.0) - 2014-05-15 + +### Commits + +- Bind all test methods [`1ca29e2`](https://github.com/ljharb/tape/commit/1ca29e26ea7821ed30be982494c3e9d3c3100c06) +- Test that we can call assertion functions directly [`f9774cc`](https://github.com/ljharb/tape/commit/f9774cc078142081c0133e090723f27cad367534) +- Fix Test constructor so that it doesn't accidentally mutate global scope [`ba3bcbb`](https://github.com/ljharb/tape/commit/ba3bcbb8a62194ee79f814ff688065c6041cb0ed) +- formatting [`aacd7a9`](https://github.com/ljharb/tape/commit/aacd7a90d1ac5f306ffaf66d21884e2cff941408) + +## [v2.12.3](https://github.com/ljharb/tape/compare/v2.12.2...v2.12.3) - 2014-04-04 + +### Commits + +- Remove dependency on util builtin [`d39b0eb`](https://github.com/ljharb/tape/commit/d39b0ebaa6639d4d9ca568547ef977259d10d465) + +## [v2.12.2](https://github.com/ljharb/tape/compare/v2.12.1...v2.12.2) - 2014-04-02 + +## [v2.12.1](https://github.com/ljharb/tape/compare/v2.12.0...v2.12.1) - 2014-03-29 + +### Commits + +- do not set canEmitExit with browserify process shim [`0212262`](https://github.com/ljharb/tape/commit/0212262b2c80665486219e92c2ab421aa8907715) + +## [v2.12.0](https://github.com/ljharb/tape/compare/v2.11.1...v2.12.0) - 2014-03-23 + +### Commits + +- switches are weird [`aae89ee`](https://github.com/ljharb/tape/commit/aae89ee56d2a7b47c6a074c8a8ca7a1b66a7f0a7) +- Moving the name/opts/cb code out into a reusable internal function. [`88e296f`](https://github.com/ljharb/tape/commit/88e296ff8179f9f270c0eefdf2f4cacb17c933d4) +- Adding Test.skip. [`f9aa185`](https://github.com/ljharb/tape/commit/f9aa1856d377fb80ec0b8e955964d562696a6cd6) + +## [v2.11.1](https://github.com/ljharb/tape/compare/v2.11.0...v2.11.1) - 2014-04-02 + +### Commits + +- do not set canEmitExit with browserify process shim [`a28db7e`](https://github.com/ljharb/tape/commit/a28db7eb238f679591d6019a1511b4ebfab8ec39) + +## [v2.11.0](https://github.com/ljharb/tape/compare/v2.10.3...v2.11.0) - 2014-03-21 + +### Commits + +- upgrade object-inspect [`30cd35c`](https://github.com/ljharb/tape/commit/30cd35cbda79bf5c302650dd619327410a0eeae8) + +## [v2.10.3](https://github.com/ljharb/tape/compare/v2.10.2...v2.10.3) - 2014-04-02 + +### Commits + +- do not set canEmitExit with browserify process shim [`ebdbba6`](https://github.com/ljharb/tape/commit/ebdbba6cd9daabd981538646f27fa152f77c2c20) + +## [v2.10.2](https://github.com/ljharb/tape/compare/v2.10.1...v2.10.2) - 2014-03-04 + +### Commits + +- fix trailing comma [`71adf6a`](https://github.com/ljharb/tape/commit/71adf6a50fdc2fc76b81350fd72ffecf574f8777) + +## [v2.10.1](https://github.com/ljharb/tape/compare/v2.10.0...v2.10.1) - 2014-03-04 + +### Commits + +- merged [`29437f7`](https://github.com/ljharb/tape/commit/29437f7805064ef41a7128c92bb6b1c826eb8042) + +## [v2.10.0](https://github.com/ljharb/tape/compare/v2.9.1...v2.10.0) - 2014-03-04 + +### Commits + +- passing nested test [`db1baf0`](https://github.com/ljharb/tape/commit/db1baf02bc1982fa177e99c39e08fa2224708156) +- subcount test [`e98ead5`](https://github.com/ljharb/tape/commit/e98ead5752c64ea958393fa0782209c978b1f92f) +- glob files in the runner [`c9da9ff`](https://github.com/ljharb/tape/commit/c9da9ff9c446eae438703608e8c02b9a09b60da8) + +## [v2.9.1](https://github.com/ljharb/tape/compare/v2.9.0...v2.9.1) - 2014-04-02 + +### Commits + +- do not set canEmitExit with browserify process shim [`4f33ae5`](https://github.com/ljharb/tape/commit/4f33ae5f9236f9fc8a4f4f88390ae5400de821a7) + +## [v2.9.0](https://github.com/ljharb/tape/compare/v2.8.1...v2.9.0) - 2014-03-04 + +### Commits + +- complete double end test [`45add17`](https://github.com/ljharb/tape/commit/45add173cf5ed739fae31a90c64eb3d8b308260e) +- omit expected and actual if there is no actual or expected [`b6ac9bf`](https://github.com/ljharb/tape/commit/b6ac9bf80615ffcda4b9a3a16e8792dee3db1d89) +- failing test for calling .end() twice [`c0a9a29`](https://github.com/ljharb/tape/commit/c0a9a297abd168d4fa0ae2b29897d30ab532b121) +- guard against calling .end() twice [`8d25028`](https://github.com/ljharb/tape/commit/8d25028500e76d49e907fc118dd2a6a9502d7071) + +## [v2.8.1](https://github.com/ljharb/tape/compare/v2.8.0...v2.8.1) - 2014-04-02 + +### Commits + +- do not set canEmitExit with browserify process shim [`0e47a93`](https://github.com/ljharb/tape/commit/0e47a9359b9e6df0d5fd7bc1d17d7d8159b5d218) + +## [v2.8.0](https://github.com/ljharb/tape/compare/v2.7.3...v2.8.0) - 2014-03-04 + +### Commits + +- remove .bind(), formatting [`7092104`](https://github.com/ljharb/tape/commit/7092104828b58d6ddb409211b1606ee5f42a1236) + +## [v2.7.3](https://github.com/ljharb/tape/compare/v2.7.2...v2.7.3) - 2014-04-02 + +### Commits + +- do not set canEmitExit with browserify process shim [`ff3e84f`](https://github.com/ljharb/tape/commit/ff3e84f94f1e4b26bab4aabeee2c1f8ed1015684) + +## [v2.7.2](https://github.com/ljharb/tape/compare/v2.7.1...v2.7.2) - 2014-03-04 + +### Commits + +- another only test, passes [`ff3c79b`](https://github.com/ljharb/tape/commit/ff3c79b51a345f4815bb45182d464e3e8b14f049) +- fix for test.only only2 test [`40cad7d`](https://github.com/ljharb/tape/commit/40cad7d313b9513b6e3ab4a4d4cafbe9c9b94934) +- failing test.only test [`412d169`](https://github.com/ljharb/tape/commit/412d16988e47cfce7cba27c94ac2bba70cefc6e3) + +## [v2.7.1](https://github.com/ljharb/tape/compare/v2.7.0...v2.7.1) - 2014-03-04 + +### Commits + +- fix wrong package name [`d5f87c0`](https://github.com/ljharb/tape/commit/d5f87c030c8ac1f96ba98d38cdb96f17a79f42cb) + +## [v2.7.0](https://github.com/ljharb/tape/compare/v2.6.1...v2.7.0) - 2014-03-04 + +### Merged + +- Clarify how to access the output stream [`#65`](https://github.com/ljharb/tape/pull/65) + +### Fixed + +- Clarify how to access the output stream [`#63`](https://github.com/ljharb/tape/issues/63) + +### Commits + +- using object-inspect for comparisons, passing the undef test [`49963b3`](https://github.com/ljharb/tape/commit/49963b3d1abf71e72a4a71f40c271bc9afe13d78) +- failing undef test [`9ee8421`](https://github.com/ljharb/tape/commit/9ee84219bde718af19cdd7f14d268fd59530c024) +- update docs [`984b21f`](https://github.com/ljharb/tape/commit/984b21fbbb5b3bf2c1a1cfc2fea33894ec042619) + +## [v2.6.1](https://github.com/ljharb/tape/compare/v2.6.0...v2.6.1) - 2014-04-02 + +### Commits + +- do not set canEmitExit with browserify process shim [`7164a03`](https://github.com/ljharb/tape/commit/7164a031b828c0493175867b92e69512f9223867) + +## [v2.6.0](https://github.com/ljharb/tape/compare/v2.5.1...v2.6.0) - 2014-03-03 + +### Commits + +- documented custom reporters [`7572828`](https://github.com/ljharb/tape/commit/75728289fa5e3b00103662e820cb1319c4cef2ef) +- objectMode for stream output [`26c05e3`](https://github.com/ljharb/tape/commit/26c05e33e7a2ee4e157f6049ed6ee712cbe3da6a) +- .createStream() for tap output on the default harness [`5d2cd63`](https://github.com/ljharb/tape/commit/5d2cd6319dc33696b874c9908d28eab195eff675) +- stream example [`47848f2`](https://github.com/ljharb/tape/commit/47848f2dd52f09b4cc0752b87d15529590517d69) +- only render the test events right before they begin [`9da8dff`](https://github.com/ljharb/tape/commit/9da8dff8670f73f8a57fa636947aea3b687a9edd) + +## [v2.5.1](https://github.com/ljharb/tape/compare/v2.5.0...v2.5.1) - 2014-04-02 + +### Commits + +- do not set canEmitExit with browserify process shim [`40cf488`](https://github.com/ljharb/tape/commit/40cf48878991e0d66509e1f36f4c191265c77ea0) + +## [v2.5.0](https://github.com/ljharb/tape/compare/v2.4.3...v2.5.0) - 2014-02-20 + +### Fixed + +- Fixes #55 - Callback optional. [`#55`](https://github.com/ljharb/tape/issues/55) + +### Commits + +- No callback is equivalent to skipping. [`9f7a2d0`](https://github.com/ljharb/tape/commit/9f7a2d0516d316e9128abbb737376f59c7dae647) + +## [v2.4.3](https://github.com/ljharb/tape/compare/v2.4.2...v2.4.3) - 2014-04-02 + +### Commits + +- do not set canEmitExit with browserify process shim [`d282191`](https://github.com/ljharb/tape/commit/d282191d2657d37cfb8d8e1250dba06744b349e7) + +## [v2.4.2](https://github.com/ljharb/tape/compare/v2.4.1...v2.4.2) - 2014-02-01 + +### Commits + +- Reduce stack size. [`3b05526`](https://github.com/ljharb/tape/commit/3b0552657177cd56635b19b135021342d4fecb2c) +- re-indent. Fuck whichever editor does this by default. [`52f3541`](https://github.com/ljharb/tape/commit/52f3541e8610af4534997ace0339b417434d2e66) + +## [v2.4.1](https://github.com/ljharb/tape/compare/v2.4.0...v2.4.1) - 2014-01-31 + +### Commits + +- should throw --> should not throw for the doesNotThrow assertion [`04f3751`](https://github.com/ljharb/tape/commit/04f37515d27b0ce846f108f72930da28b45a6100) + +## [v2.4.0](https://github.com/ljharb/tape/compare/v2.3.3...v2.4.0) - 2014-01-29 + +### Commits + +- remove the browser compat section since there is already a giant testling badge [`fe3fe96`](https://github.com/ljharb/tape/commit/fe3fe9648ab5fef5e0a8e2c76e1cb2d378667d1e) +- upgrade deep-equal to 0.2.0 [`dcf6b46`](https://github.com/ljharb/tape/commit/dcf6b46b1cadfebea25ef34f26719734349b742d) +- drop require stream [`97fede5`](https://github.com/ljharb/tape/commit/97fede5b5cc1746a53c15d26d75a6c3381a6f32b) + +## [v2.3.3](https://github.com/ljharb/tape/compare/v2.3.2...v2.3.3) - 2014-04-02 + +### Commits + +- do not set canEmitExit with browserify process shim [`59fd1dc`](https://github.com/ljharb/tape/commit/59fd1dc6aa4e3c2c399c727b3e9324038dbf87ca) + +## [v2.3.2](https://github.com/ljharb/tape/compare/v2.3.1...v2.3.2) - 2013-12-17 + +### Commits + +- fix to define the stream so it can emit errors [`00af8ed`](https://github.com/ljharb/tape/commit/00af8ed795202356b172fcd8b48b8d64037397c4) + +## [v2.3.1](https://github.com/ljharb/tape/compare/v2.3.0...v2.3.1) - 2013-12-17 + +### Commits + +- drop split and stream-combiner to make the default stream not drop newlines in ie<9 [`ea56255`](https://github.com/ljharb/tape/commit/ea562557b7598c13ce498a64d47b299e967d04bc) + +## [v2.3.0](https://github.com/ljharb/tape/compare/v2.2.2...v2.3.0) - 2013-11-22 + +### Commits + +- suppress EPIPE but set the exit code to 1 so test results may be piped around to head/grep/tail [`1589695`](https://github.com/ljharb/tape/commit/158969558f9d1376344a15ba6bb590cae41609a7) + +## [v2.2.2](https://github.com/ljharb/tape/compare/v2.2.1...v2.2.2) - 2014-04-02 + +### Commits + +- do not set canEmitExit with browserify process shim [`87eb6bc`](https://github.com/ljharb/tape/commit/87eb6bc455a6d931f5bf0efa0fefb5e710360e10) + +## [v2.2.1](https://github.com/ljharb/tape/compare/v2.2.0...v2.2.1) - 2013-11-22 + +### Commits + +- forgot the resumer dep [`9882d34`](https://github.com/ljharb/tape/commit/9882d3499d3157a230bccebd9476202a04b37c0e) + +## [v2.2.0](https://github.com/ljharb/tape/compare/v2.1.1...v2.2.0) - 2013-11-22 + +### Commits + +- is now properly noisy when more commits than expected were run [`2954dac`](https://github.com/ljharb/tape/commit/2954dacdef87324ae0a192deac194f83c6200441) +- rip out the old `new Stream` default stream to just use split, duplexer, and through [`021da85`](https://github.com/ljharb/tape/commit/021da85e63a6748fc85825663c6db69a2a370451) +- properly fixed the default stream [`2ce40f5`](https://github.com/ljharb/tape/commit/2ce40f57216d647ca49f86c4b717aa1a1fc36774) + +## [v2.1.1](https://github.com/ljharb/tape/compare/v2.1.0...v2.1.1) - 2014-04-02 + +### Commits + +- do not set canEmitExit with browserify process shim [`c9d502e`](https://github.com/ljharb/tape/commit/c9d502ec3da3971e34e4493593506c17ec466fcf) + +## [v2.1.0](https://github.com/ljharb/tape/compare/v2.0.2...v2.1.0) - 2013-10-25 + +### Commits + +- Refactor test-ordering logic [`48964a6`](https://github.com/ljharb/tape/commit/48964a6b479df326248dfe8ddeb056a667ea5f55) +- Count subtests against the plan [`978431c`](https://github.com/ljharb/tape/commit/978431c8a6db8cf3925a8b1b95a771aa872b9283) +- Add nested-sync-noplan-noend [`8449f1c`](https://github.com/ljharb/tape/commit/8449f1c1600eec44153eab0b430bd00e50598d40) +- Add test for async asserts in subtests ref #42 [`9d64ad3`](https://github.com/ljharb/tape/commit/9d64ad33a9e74d48614136e0ec54e1f2eac01dad) +- Add failing test for planning # of subtests [`bc03743`](https://github.com/ljharb/tape/commit/bc037437d658b050347220c0f8c2ff101d669dd9) +- Remove comment block [`2c06852`](https://github.com/ljharb/tape/commit/2c068521e2db12327ee381cb09a5a2b81af7d06c) +- Revert "Add test for running children asynchronously" [`c39be29`](https://github.com/ljharb/tape/commit/c39be29cd9063497506b63e27ba715e3101ca666) +- Add test for running children asynchronously [`709c36a`](https://github.com/ljharb/tape/commit/709c36afe5d9aef36a35cc0dbb461bcfe8714a94) +- add test for asynchronously adding subtests [`8b59a80`](https://github.com/ljharb/tape/commit/8b59a8010fb4441f9fc5f17c70d06ddb903d7aae) +- Add second @spion patch [`35f29a8`](https://github.com/ljharb/tape/commit/35f29a8d12857e28a04acc374682704a0359c942) +- Revert "Add patch from @spion to make nested-sync-noplan-noend pass" [`a43860b`](https://github.com/ljharb/tape/commit/a43860b1225e43c2894cf85472f22ec5d5e31c94) +- Add patch from @spion to make nested-sync-noplan-noend pass [`188fbb1`](https://github.com/ljharb/tape/commit/188fbb15456774a917619f95af8d04dfcd28f1b2) +- Remove 'next' event [`78e48c9`](https://github.com/ljharb/tape/commit/78e48c9fa90d1326abb5623b08f7617bfd730a47) +- Add checks against double-execution of child tests [`cfff35b`](https://github.com/ljharb/tape/commit/cfff35b68a5d2701c08d32797bb73d92eabb3bed) + +## [v2.0.2](https://github.com/ljharb/tape/compare/v2.0.1...v2.0.2) - 2014-04-02 + +### Commits + +- do not set canEmitExit with browserify process shim [`66c0a7d`](https://github.com/ljharb/tape/commit/66c0a7d6a48498ae58df7ecc75c4f3cfa39eb08e) + +## [v2.0.1](https://github.com/ljharb/tape/compare/v2.0.0...v2.0.1) - 2013-10-25 + +### Commits + +- toStringified msg to prevent TypeError [`37305c2`](https://github.com/ljharb/tape/commit/37305c2626c430bebdb646fddab91c30b2d3c247) + +## [v2.0.0](https://github.com/ljharb/tape/compare/v1.1.2...v2.0.0) - 2013-10-14 + +### Commits + +- strict deep equal comparisons [`95f827d`](https://github.com/ljharb/tape/commit/95f827d8121cc751ba6c9f7d66bc8626105e0792) +- document strict/loose deep equals [`785be99`](https://github.com/ljharb/tape/commit/785be995ef8165c0c67534429f9de879512a9bb0) +- failing deep strict equal test [`d56754a`](https://github.com/ljharb/tape/commit/d56754a281edc6d9f9eac5b563cb8668952b8d09) + +## [v1.1.2](https://github.com/ljharb/tape/compare/v1.1.1...v1.1.2) - 2016-03-06 + +### Merged + +- [Fix] Ensure that non-functions passed to `throws` fail the test, just like `assert` [`#268`](https://github.com/ljharb/tape/pull/268) + +### Commits + +- Minor test tweaks due to output differences in v1 vs v4. [`d22b5fc`](https://github.com/ljharb/tape/commit/d22b5fc48f7053dbf3bc1f4804783a61534edf33) +- Add missing `concat-stream` devDep [`8b3c1b7`](https://github.com/ljharb/tape/commit/8b3c1b7f76a8b7ac8165cac08105bd0ac390e867) +- gitignore node_modules [`3495543`](https://github.com/ljharb/tape/commit/3495543d1cdd2bab3676bf23b09cb319f0b02954) + +## [v1.1.1](https://github.com/ljharb/tape/compare/v1.1.0...v1.1.1) - 2013-09-20 + +### Commits + +- Fix at printing [`fae125e`](https://github.com/ljharb/tape/commit/fae125e13e55ffcd4481cebdf86a009457cc5eda) + +## [v1.1.0](https://github.com/ljharb/tape/compare/v1.0.4...v1.1.0) - 2013-09-03 + +### Commits + +- test.only should not run any other test blocks [`1f56566`](https://github.com/ljharb/tape/commit/1f565663ec945f06e225ba3b11787687ffdc2b13) +- failing test for t.only() firing tests unnecessarily [`bd3f198`](https://github.com/ljharb/tape/commit/bd3f198946f9010e01a9ae55733aef1eef7b1532) +- fix typoes [`8cf5c67`](https://github.com/ljharb/tape/commit/8cf5c675a5b2be726fd483eb09e0fc7417919d99) + +## [v1.0.4](https://github.com/ljharb/tape/compare/v1.0.3...v1.0.4) - 2013-06-08 + +### Commits + +- re-throw error to get it to show [`a51e872`](https://github.com/ljharb/tape/commit/a51e87240d2c12f57f9608f982e4c653c0e028ce) + +## [v1.0.3](https://github.com/ljharb/tape/compare/v1.0.2...v1.0.3) - 2013-06-07 + +### Commits + +- do not call process.exit() on uncaught exception [`3801e20`](https://github.com/ljharb/tape/commit/3801e2051aaa2ea404cbb4beedfcce00fec234eb) + +## [v1.0.2](https://github.com/ljharb/tape/compare/v1.0.1...v1.0.2) - 2013-05-08 + +### Commits + +- cant lazy load only. Has to be a property of the exported thing [`c5a4731`](https://github.com/ljharb/tape/commit/c5a4731b29ea16cd4f1b40fb2d968937ce1215eb) +- Add the only property back to the exported test function [`d22deba`](https://github.com/ljharb/tape/commit/d22deba6da4da8b94e7a3a352eb029afecdaaadf) + +## [v1.0.1](https://github.com/ljharb/tape/compare/v1.0.0...v1.0.1) - 2013-05-03 + +### Commits + +- forgot to add a test [`40b229a`](https://github.com/ljharb/tape/commit/40b229a9b5727bebf79299c2bca8e784f33888a2) +- forgot to add through [`d729135`](https://github.com/ljharb/tape/commit/d729135b33e22b18e10416a837067f4eaa248485) + +## [v1.0.0](https://github.com/ljharb/tape/compare/v0.3.3...v1.0.0) - 2013-05-03 + +### Commits + +- took out lots of complexity, refactoring [`827b59d`](https://github.com/ljharb/tape/commit/827b59d281ece73859ac77524d0e5857f5070436) +- basic example finally works [`2a59c49`](https://github.com/ljharb/tape/commit/2a59c49ec44c7d8e56adf5b6951e1271293dd343) +- removing harness test, not sure why it's broken on 0.8 [`bd9e9a6`](https://github.com/ljharb/tape/commit/bd9e9a6aefa7f7129131a98dda3966d58d8a1c08) +- nested test nearly works [`7951747`](https://github.com/ljharb/tape/commit/7951747f2f8b38a60c2a5b76a8f86741ebf8191b) +- refactor exit logic [`890382d`](https://github.com/ljharb/tape/commit/890382dd3509d5817fc0a65a4df5f5cadbfd9a91) +- fixed for the two example [`0ac88b8`](https://github.com/ljharb/tape/commit/0ac88b870c99dc3d9e6280f839d7023ecd922fe0) +- use a createStream() function instead of .stream [`6417cdc`](https://github.com/ljharb/tape/commit/6417cdcd90ac712f8a5f3f849f93518cc59cac52) +- fix harness test [`fa706ae`](https://github.com/ljharb/tape/commit/fa706aeb59bb9627b0b6740a795241d6c76dfe91) +- no longer getting already closed errors by tracking the number of running tests [`c9def14`](https://github.com/ljharb/tape/commit/c9def140ee0f7d3d44dc9c3e2b420192090d1c90) +- child ordering output is now correct [`5544d26`](https://github.com/ljharb/tape/commit/5544d26ddd36047db3d5ac699f3c4f6158e63dc7) +- only test passes [`4fbabba`](https://github.com/ljharb/tape/commit/4fbabba2478d263a8adeb2b3d4314ab06f9874c9) +- check for end and call ._exit() if unended [`ce0d62c`](https://github.com/ljharb/tape/commit/ce0d62c5a58de42959d35ebec5a65598432dd179) +- fixed the many test, broke the exit test [`72e34ad`](https://github.com/ljharb/tape/commit/72e34ad9e2eb4314b914d8a74222b263a8221dc1) +- passing one more of the exit tests [`5ec8f42`](https://github.com/ljharb/tape/commit/5ec8f42bcfbfa15edfeb04b1d632d9c9316bad68) +- nested test at least finishes now [`6252fd2`](https://github.com/ljharb/tape/commit/6252fd201e7cb73036249130112ffc4ec2dc2372) +- fix default harness going off unexpectedly [`b1c1d6a`](https://github.com/ljharb/tape/commit/b1c1d6a15e14e975cd0c0792d7c5d2a696c3cae3) +- special case for exiting, all tests pass now [`88de699`](https://github.com/ljharb/tape/commit/88de69987bb25fbf9ed18b1b7168488752a3af2e) +- passing the skip test [`876930e`](https://github.com/ljharb/tape/commit/876930ecea8b26f056c7c9f2e12f08f7017bcdce) +- update the tests to use createStream [`9420e07`](https://github.com/ljharb/tape/commit/9420e07f324b01b0e7453b2341f55987945df816) +- check pause status before resuming [`606b141`](https://github.com/ljharb/tape/commit/606b14118e0d810adc780d27031406aa90f91c1b) +- nested example completely works [`a5e709e`](https://github.com/ljharb/tape/commit/a5e709eb86c946f2e79a758c14778583dc764ea8) +- only the exported harness will be piped to the default stream [`6df7fc0`](https://github.com/ljharb/tape/commit/6df7fc0766bb9c15b83403e46e6e0a6e68645f64) +- exit test completely passes [`f37d431`](https://github.com/ljharb/tape/commit/f37d431ff3f6f1fc3ca0cb602806628afca401bf) +- fixed the nested test [`4f05679`](https://github.com/ljharb/tape/commit/4f056797d7003cb4a3cbbb85275257779ce34a4f) +- getting further into the child ordering test [`8a80302`](https://github.com/ljharb/tape/commit/8a80302a2f34274147c8464099d05ad48cc922ac) +- getting further into the child ordering test [`365ceab`](https://github.com/ljharb/tape/commit/365ceabb8d6f90917aeab8bedcf0b6ddba355a88) +- update the harness test for createStream [`5329dc6`](https://github.com/ljharb/tape/commit/5329dc626400169e115fe6aec87bea459def6956) +- partial fix for v0.10 exiting early [`78c7b77`](https://github.com/ljharb/tape/commit/78c7b7727bf67a7be4965c00f07c996157133265) +- partly fixed the test name ordering issue [`c4dc7ac`](https://github.com/ljharb/tape/commit/c4dc7aced29b27bba0bcf88b68a33c1edf003acb) + +## [v0.3.3](https://github.com/ljharb/tape/compare/v0.3.2...v0.3.3) - 2013-04-01 + +### Commits + +- using testling [`4fe80b3`](https://github.com/ljharb/tape/commit/4fe80b3a31f065240b255998916f1dd98ef160c9) +- use setImmediate on 0.10 [`d5b3bc2`](https://github.com/ljharb/tape/commit/d5b3bc26c9b9c9c5348a183c538a063f31555c6f) +- stub out .map() [`95f1bb4`](https://github.com/ljharb/tape/commit/95f1bb4e3320acfbdb57e4c3818dea3cbe84896f) +- minor fix for 0.10 [`52e25d8`](https://github.com/ljharb/tape/commit/52e25d8f78d00bcaf855ec2916684c9ba15e1caf) +- drop 0.6, add 0.10 in travis [`04253f6`](https://github.com/ljharb/tape/commit/04253f62cd59bb71b81f889ea46f0671323e7725) +- guard process.exit() with a canExit for browsers [`50f03fd`](https://github.com/ljharb/tape/commit/50f03fdcfc6c53f4bc3ef8fa4ae29d5e2941c0ef) + +## [v0.3.2](https://github.com/ljharb/tape/compare/v0.3.1...v0.3.2) - 2013-03-25 + +### Commits + +- failing exit test for 2nd test() plans [`e7d00be`](https://github.com/ljharb/tape/commit/e7d00be1662868a5da776e9a093fc857680153aa) +- use a setInterval to keep the event loop alive [`c20c556`](https://github.com/ljharb/tape/commit/c20c556d2199a6ce4605f09ca3405b6ea91cf82e) +- clean up the global harness exit interval [`361ecb6`](https://github.com/ljharb/tape/commit/361ecb6ce4e68bb5366b83045a82eea9cffa894d) +- fix the second exit test asserts [`c85294a`](https://github.com/ljharb/tape/commit/c85294a4a335f3cad4a2e7de9c685fd0fe044b24) + +## [v0.3.1](https://github.com/ljharb/tape/compare/v0.3.0...v0.3.1) - 2013-03-21 + +### Commits + +- use json-stringify-safe in render.js to not throw on circular structures [`51a4e66`](https://github.com/ljharb/tape/commit/51a4e66ce27a1edd42a6a00ec1c183536ad496b7) +- implemented decycle for JSON.stringify that should work in IE [`178a8dc`](https://github.com/ljharb/tape/commit/178a8dc329ed57d23222be2f1bdbd440e4618368) + +## [v0.3.0](https://github.com/ljharb/tape/compare/v0.2.2...v0.3.0) - 2013-03-11 + +### Commits + +- add small test runner [`80e309a`](https://github.com/ljharb/tape/commit/80e309ad6ae355bddaee54a33a1b69b871cff322) + +## [v0.2.2](https://github.com/ljharb/tape/compare/v0.2.1...v0.2.2) - 2013-01-18 + +### Commits + +- fix merge conflicts [`5e53c14`](https://github.com/ljharb/tape/commit/5e53c14c4ee8caec01714f943c7b153478a0002f) +- Do not close renderer twice. [`ad90739`](https://github.com/ljharb/tape/commit/ad90739e9f1d6824ec55c990748f4c61c6d856c6) +- whitespace back [`2666849`](https://github.com/ljharb/tape/commit/266684958a3f8e5ed9ed9436107a5940a2e1bb29) +- fix close bug [`bd1db4e`](https://github.com/ljharb/tape/commit/bd1db4ee2d6129dfad57187ea7ccdc1522178f6b) + +## [v0.2.1](https://github.com/ljharb/tape/compare/v0.2.0...v0.2.1) - 2013-01-18 + +### Commits + +- test.only [`8a99091`](https://github.com/ljharb/tape/commit/8a990919f4d869b1ce7251797edd69f37dbdd706) +- undo whitespace [`6e1cd97`](https://github.com/ljharb/tape/commit/6e1cd97536620ae5c657d3feafd9e4055b4641c5) +- bad comma [`f0fd72a`](https://github.com/ljharb/tape/commit/f0fd72a15350b98c2e3786a36c6837628171add4) + +## [v0.2.0](https://github.com/ljharb/tape/compare/v0.1.5...v0.2.0) - 2013-01-17 + +### Commits + +- show `at` locations in errors [`35ba8a3`](https://github.com/ljharb/tape/commit/35ba8a36f023361089d1d09c122a8288cb061ede) +- tape drive image [`1786bcc`](https://github.com/ljharb/tape/commit/1786bccafca6abbee091e4b9bf64bf0c1c7bbc17) + +## [v0.1.5](https://github.com/ljharb/tape/compare/v0.1.4...v0.1.5) - 2012-12-20 + +### Commits + +- failing max listeners test [`4058f75`](https://github.com/ljharb/tape/commit/4058f754e633d44c226d92a64fcc30aced7db3a3) +- avoid max listeners warnings, test passes [`2f8a822`](https://github.com/ljharb/tape/commit/2f8a822688581fb1c506ab51921aff40429fb45c) + +## [v0.1.4](https://github.com/ljharb/tape/compare/v0.1.3...v0.1.4) - 2012-12-20 + +### Commits + +- put back whitespace to annoy @Raynos [`ce84d89`](https://github.com/ljharb/tape/commit/ce84d891e86a20a2bcf8a6bd1f31226d745e0a8c) +- failing order test [`c3b7dda`](https://github.com/ljharb/tape/commit/c3b7ddaf2f58d487673c91a3fb9b24e5510db9ed) +- failing order test [`ea0eff9`](https://github.com/ljharb/tape/commit/ea0eff904121d8be2348e0a9313afeae86f721c4) +- NO MERGE CONFLICT [`9241450`](https://github.com/ljharb/tape/commit/9241450e865b0aed098663f16edec01f96ebae1b) +- Count the number of times `test` is invoked [`e436a61`](https://github.com/ljharb/tape/commit/e436a61cee255579521538bce7f68851f8065e75) +- fixed bug [`c32b131`](https://github.com/ljharb/tape/commit/c32b13155708f8084f585f793a1995ce4a2e598d) +- Synchronous race conditions [`19d7f88`](https://github.com/ljharb/tape/commit/19d7f885bae8bc8e067d4ffcbb6d696acebca3f8) +- dont log [`359a67f`](https://github.com/ljharb/tape/commit/359a67f9a00d101581da2f7b16bb0417f2acbada) + +## [v0.1.3](https://github.com/ljharb/tape/compare/v0.1.2...v0.1.3) - 2012-12-19 + +### Commits + +- fix the optional plan test on 0.6 [`af728e8`](https://github.com/ljharb/tape/commit/af728e8b869a011785a9a5d17f514be8e401e34c) +- fix for the exit test on 0.6 [`17d0335`](https://github.com/ljharb/tape/commit/17d03354276fb82cc756cbcf13c82826652f76d5) + +## [v0.1.2](https://github.com/ljharb/tape/compare/v0.1.1...v0.1.2) - 2012-12-19 + +### Commits + +- not enough example [`9b2ffe1`](https://github.com/ljharb/tape/commit/9b2ffe1031c1e24ea1990324d6f7ee709d28f8f1) +- only do console.log() mode, fix double \n bug [`028e858`](https://github.com/ljharb/tape/commit/028e858f85c6916a730dca183c00469ebb869729) + +## [v0.1.1](https://github.com/ljharb/tape/compare/v0.1.0...v0.1.1) - 2012-12-12 + +### Fixed + +- Handle regexp in throws. Fixes #8 [`#8`](https://github.com/ljharb/tape/issues/8) + +## [v0.1.0](https://github.com/ljharb/tape/compare/v0.0.5...v0.1.0) - 2012-12-03 + +### Commits + +- failing exit test [`104af1f`](https://github.com/ljharb/tape/commit/104af1fcad7f92d866cc2ddc7e4f688c854995cb) +- passing exit ok test [`7de897c`](https://github.com/ljharb/tape/commit/7de897c665367a61f7ed6773216e90b1b662e6c3) +- too few assertion test [`4ae9c04`](https://github.com/ljharb/tape/commit/4ae9c049f28f45f5b50104b2dc4694c1b3712f6f) +- feature-detect process.exit() and "exit" events, exit tests now passes [`6fc71ba`](https://github.com/ljharb/tape/commit/6fc71bab2efae31b574a327de23d491345f4f504) +- failing throw test [`3d58fef`](https://github.com/ljharb/tape/commit/3d58fefe2c323e70f9f3442ca127e9ec23065c87) +- throw test passes [`37f79d2`](https://github.com/ljharb/tape/commit/37f79d242b104bfb80b3152a2ee86e105be251a3) +- better error messages with stack traces [`1f1fcf7`](https://github.com/ljharb/tape/commit/1f1fcf76cfe46cf1cc613538d36face17733e89a) +- update tests to thread through exit: false [`c8e11e1`](https://github.com/ljharb/tape/commit/c8e11e1f2c9b537c7fbf5bdf1cb6defaa83f41e3) +- clean up feature detection [`329f784`](https://github.com/ljharb/tape/commit/329f784fbd42de778a09df441ad0a8595650c9c8) +- 0.1.0 now with exit and exception handling [`ba72d57`](https://github.com/ljharb/tape/commit/ba72d5754ec4b6b70e4535d6dc3909352c48eac7) + +## [v0.0.5](https://github.com/ljharb/tape/compare/v0.0.4...v0.0.5) - 2012-11-28 + +### Commits + +- fix typo in t.notOk() [`369e7ee`](https://github.com/ljharb/tape/commit/369e7eef5fce3e91b9b21dfe5f915b1505edd82e) + +## [v0.0.4](https://github.com/ljharb/tape/compare/v0.0.3...v0.0.4) - 2012-11-26 + +### Commits + +- Return t [`21afbcb`](https://github.com/ljharb/tape/commit/21afbcb522c219ac65a6d2720aa2679b7d925eee) + +## [v0.0.3](https://github.com/ljharb/tape/compare/v0.0.2...v0.0.3) - 2012-11-25 + +### Commits + +- using `defined` for defined-or (//) [`6ce0e1a`](https://github.com/ljharb/tape/commit/6ce0e1a926c6f81504cd3d9e72254bf6815e0088) + +## [v0.0.2](https://github.com/ljharb/tape/compare/v0.0.1...v0.0.2) - 2012-11-25 + +### Fixed + +- Handle children in order, and grandchildren [`#5`](https://github.com/ljharb/tape/issues/5) [`#6`](https://github.com/ljharb/tape/issues/6) +- Fix #3 Implement Test.comment [`#3`](https://github.com/ljharb/tape/issues/3) + +### Commits + +- A test for createHarness [`21fe619`](https://github.com/ljharb/tape/commit/21fe61941b05171eda6a4b40f20e918f205e9303) + +## [v0.0.1](https://github.com/ljharb/tape/compare/v0.0.0...v0.0.1) - 2012-11-25 + +### Fixed + +- Fix child ordering [`#4`](https://github.com/ljharb/tape/issues/4) +- Use conf object, support skipping entire tests [`#2`](https://github.com/ljharb/tape/issues/2) +- plan() should be optional [`#1`](https://github.com/ljharb/tape/issues/1) + +### Commits + +- browser example [`6192cb5`](https://github.com/ljharb/tape/commit/6192cb55175d3eecdf619207ea75a4ce70671c61) +- browser compatibility notes [`0557b39`](https://github.com/ljharb/tape/commit/0557b3945d47c6ac5ba7e82762ce564ed0f149b8) +- fix keyword silliness [`e14cce3`](https://github.com/ljharb/tape/commit/e14cce3a3ad8cdb48f40dc3d640e37830968ec59) + +## v0.0.0 - 2012-11-25 + +### Commits + +- mostly compatible with node-tap assertions, stubbed out assertion-to-TAP logic [`7948e2e`](https://github.com/ljharb/tape/commit/7948e2ee439135efee86ea0b7ce24c9deea4b018) +- documentation, test.stream [`7e1d1f0`](https://github.com/ljharb/tape/commit/7e1d1f060b018bc81ee924c64f14ee2fda33d853) +- fix double-piping bug in the output [`ddd2535`](https://github.com/ljharb/tape/commit/ddd2535d2e103a8461db808ed7d262b3cd1930d1) +- failing nested test [`422bfb4`](https://github.com/ljharb/tape/commit/422bfb48e97ef3fb99012765760abee16935e6f8) +- passing too many test [`e888fbb`](https://github.com/ljharb/tape/commit/e888fbb72d54c098143324d0bbe5ce16619b3220) +- passing fail test [`5c2dfed`](https://github.com/ljharb/tape/commit/5c2dfed364155240d00d04db56f28431606a9481) +- passing array test [`7991377`](https://github.com/ljharb/tape/commit/79913770856c3470d79e59b5761a2bf15bf78c71) +- package.json etc [`a5b83f2`](https://github.com/ljharb/tape/commit/a5b83f2f10afc363b5086281fa8797e906008413) +- nested failure example [`1ea9057`](https://github.com/ljharb/tape/commit/1ea9057585ae957f0a15d37afdf9872625d1e996) +- basic tap output works [`53ab0e8`](https://github.com/ljharb/tape/commit/53ab0e8dadc2b5a415183633b67b6339b2ecac16) +- nested tests work [`c9ca5be`](https://github.com/ljharb/tape/commit/c9ca5be0de56ee26a40347e2f17496c307ce355d) +- plan errors [`40aafce`](https://github.com/ljharb/tape/commit/40aafce59661cc2f89e9702e0cbb69fd568a1f20) +- expected, actual, and operator keys in yaml-esque format on assertion failures [`dab1314`](https://github.com/ljharb/tape/commit/dab13148eceaaac81c1fbb92004fe7663c839e5b) +- send the end event properly [`46fb0a1`](https://github.com/ljharb/tape/commit/46fb0a1e5b305d07ffaf1c464325356c269fb5fe) +- trailing tap data [`463afd2`](https://github.com/ljharb/tape/commit/463afd287c5833917a96c44f0f4d5a8dea56f67c) +- remove nested test indents to pass the tests [`f6b844e`](https://github.com/ljharb/tape/commit/f6b844ec13e57391e37bd8eb4ab1c58aa7ef98fc) +- initial artistic direction [`da360eb`](https://github.com/ljharb/tape/commit/da360eb938e221a160408f6c49a1a3659981e410) +- using travis [`749e84f`](https://github.com/ljharb/tape/commit/749e84fa5b25f156e8d60bdd81599291c2b029d9) +- document t.test() [`77983ab`](https://github.com/ljharb/tape/commit/77983ab8093d996ed5fc59e624209d989a16c7d3) +- send the tap header [`31dae7d`](https://github.com/ljharb/tape/commit/31dae7d2c50dcba7ddf71e927ee3cb0f49c47046) diff --git a/package.json b/package.json index 58b49a06..1861c0d1 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "@ljharb/eslint-config": "^21.0.0", "array.prototype.flatmap": "^1.3.0", "aud": "^2.0.0", + "auto-changelog": "^2.4.0", "concat-stream": "^1.6.2", "eclint": "^2.8.1", "ecstatic": "^4.1.4", @@ -47,6 +48,8 @@ }, "scripts": { "prepack": "npmignore --auto --commentLines=autogenerated", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"", "prepublishOnly": "safe-publish-latest", "prepublish": "!(type not-in-publish) || not-in-publish || npm run prepublishOnly", "prelint:files": "git ls-files 2>/dev/null | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git' || echo '*.md *.js test/*.js'", @@ -89,6 +92,14 @@ "url": "https://github.com/sponsors/ljharb" }, "license": "MIT", + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, "publishConfig": { "ignore": [ ".github/workflows" From 8dd3f07c817c915452f2ebdf14d5067b98a860c2 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Mon, 19 Sep 2022 16:15:43 -0700 Subject: [PATCH 11/11] 4.16.1 --- CHANGELOG.md | 17 ++++++++++++++++- package.json | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44c1bcb5..ac849209 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -412,7 +412,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [Deps] update `resolve` [`b765bba`](https://github.com/ljharb/tape/commit/b765bba1ea56075d5382b203b6902c8fc5f2d5a6) - [Dev Deps] update `eslint` [`949781f`](https://github.com/ljharb/tape/commit/949781faf753d5481085f993210738e7b93b3172) -## [v5.0.0-next.0](https://github.com/ljharb/tape/compare/v4.16.0...v5.0.0-next.0) - 2019-12-20 +## [v5.0.0-next.0](https://github.com/ljharb/tape/compare/v4.16.1...v5.0.0-next.0) - 2019-12-20 ### Commits @@ -425,6 +425,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [meta] change dep semver prefix from ~ to ^ [`c3924d3`](https://github.com/ljharb/tape/commit/c3924d34476247e2ba0d6e0781ca89b7d25f2a2b) - [Breaking] update `deep-equal` to v2 [`898a6e7`](https://github.com/ljharb/tape/commit/898a6e70aadff95f23eb6f7b4e7a1fd24baacc7d) +## [v4.16.1](https://github.com/ljharb/tape/compare/v4.16.0...v4.16.1) - 2022-09-19 + +### Commits + +- [eslint] fix indentation [`b035590`](https://github.com/ljharb/tape/commit/b035590f782c211e93a6a44ed8d0e9d38636a286) +- [meta] add `auto-changelog` [`b467b85`](https://github.com/ljharb/tape/commit/b467b850f169bf294851c68a5c4074360d53a31b) +- [eslint] enforce `no-use-before-define` [`87deb68`](https://github.com/ljharb/tape/commit/87deb68b111fd0d94efc92c25454a6a3fcedff66) +- [eslint] clean up config a bit [`3171edd`](https://github.com/ljharb/tape/commit/3171eddd25dafb3e9a9606ac70ed6c21bb736e8e) +- [Tests] `stackTrace`: use the common `getDiag` utility [`65df5a4`](https://github.com/ljharb/tape/commit/65df5a4f194cf01c3872c713d129ac968342181c) +- [meta] fix repo URLs [`85d86a4`](https://github.com/ljharb/tape/commit/85d86a468af1b74af432d41c204efd4440b5f56f) +- Revert "[Tests] handle a broken error `cause` in node 16.9/16.10" [`775ba37`](https://github.com/ljharb/tape/commit/775ba3789e16b1464dc810243dc5866b2868fc1d) +- [meta] use `npmignore` to autogenerate an npmignore file [`1645abb`](https://github.com/ljharb/tape/commit/1645abbf47df2a8142514302da2730c54b993b47) +- [eslint] enable `func-style` [`75c0c3a`](https://github.com/ljharb/tape/commit/75c0c3a4f9452c36b5318ba6c09ab4ebc97f15d0) +- [readme] fix version badge [`20ea48d`](https://github.com/ljharb/tape/commit/20ea48d53b6492bf648d02d53c41b324abbfb6e1) + ## [v4.16.0](https://github.com/ljharb/tape/compare/v4.15.1...v4.16.0) - 2022-08-16 ### Commits diff --git a/package.json b/package.json index 1861c0d1..34c21f74 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tape", - "version": "4.16.0", + "version": "4.16.1", "description": "tap-producing test harness for node and browsers", "main": "index.js", "browser": {