From 5a52443dcb8c14a9b59523fbb1c05b139833c812 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Wed, 26 Jan 2022 11:33:18 -0800 Subject: [PATCH 1/8] [meta] remove unused travis.yml file --- .travis.yml | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7a78e0e1..00000000 --- a/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -version: ~> 1.0 -language: node_js -os: - - linux -import: - - ljharb/travis-ci:node/all.yml - - ljharb/travis-ci:node/pretest.yml From 3960ccf83722a25131522e35de63b89564eac519 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Fri, 8 Apr 2022 12:05:52 -0700 Subject: [PATCH 2/8] [Dev Deps] update `eslint`, `@ljharb/eslint-config` --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 28f756ef..e75c9a24 100644 --- a/package.json +++ b/package.json @@ -29,14 +29,14 @@ "through": "~2.3.8" }, "devDependencies": { - "@ljharb/eslint-config": "^20.2.0", + "@ljharb/eslint-config": "^20.2.3", "array.prototype.flatmap": "^1.2.5", "aud": "^2.0.0", "concat-stream": "^1.6.2", "eclint": "^2.8.1", "ecstatic": "^4.1.4", "es-value-fixtures": "^1.2.1", - "eslint": "^8.7.0", + "eslint": "=8.8.0", "falafel": "^2.2.4", "js-yaml": "^3.14.0", "safe-publish-latest": "^2.0.0", From 64677e06006e1a1e4e36dc318cc4a36b2152ed95 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Fri, 8 Apr 2022 12:06:00 -0700 Subject: [PATCH 3/8] [Deps] update `minimist` --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e75c9a24..55d70c26 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "has": "~1.0.3", "inherits": "~2.0.4", "is-regex": "~1.1.4", - "minimist": "~1.2.5", + "minimist": "~1.2.6", "object-inspect": "~1.12.0", "resolve": "~1.22.0", "resumer": "~0.0.0", From 7c6dbbdba1769bcb80b103d43c3eaa61e395dc52 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 5 Apr 2022 13:36:10 -0700 Subject: [PATCH 4/8] [meta] improve `prelint` script when no `.git` dir is present --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 55d70c26..6967c687 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,8 @@ "scripts": { "prepublishOnly": "safe-publish-latest", "prepublish": "!(type not-in-publish) || not-in-publish || npm run prepublishOnly", - "prelint": "eclint check $(git ls-files 2>/dev/null | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git' || echo '*.md *.js test/*.js')", + "prelint:files": "git ls-files 2>/dev/null | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git' || echo '*.md *.js test/*.js'", + "prelint": "FILES=\"$(npm run --silent prelint:files)\" eclint check \"${FILES:=package.json}\"", "lint": "eslint --ext .js,.cjs,.mjs . bin/*", "pretest": "npm run lint", "test": "npm run tests-only", From 48896e87cee94d8d704ff2fb2bf730c1c0a94c71 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 5 Apr 2022 23:09:40 -0700 Subject: [PATCH 5/8] [meta] ensure `prelint` works on windows --- package.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 6967c687..bc40ebf5 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "eslint": "=8.8.0", "falafel": "^2.2.4", "js-yaml": "^3.14.0", + "npm-run-posix-or-windows": "^2.0.2", "safe-publish-latest": "^2.0.0", "tap": "^8.0.1", "tap-parser": "^3.0.5" @@ -47,7 +48,9 @@ "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'", - "prelint": "FILES=\"$(npm run --silent prelint:files)\" eclint check \"${FILES:=package.json}\"", + "eclint": "FILES=\"$(npm run --silent prelint:files)\" eclint check \"${FILES:=package.json}\"", + "eclint:windows": "eclint check *.js", + "prelint": "npm-run-posix-or-windows eclint", "lint": "eslint --ext .js,.cjs,.mjs . bin/*", "pretest": "npm run lint", "test": "npm run tests-only", From 9dbe9ad9163835edb302505dec26a8e21f20d893 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Fri, 8 Apr 2022 10:52:24 -0700 Subject: [PATCH 6/8] [Robustness] `test` observably looks up `exec` on the object --- lib/test.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/test.js b/lib/test.js index e582b876..2e6c8a0b 100644 --- a/lib/test.js +++ b/lib/test.js @@ -13,7 +13,7 @@ var forEach = require('for-each'); var inspect = require('object-inspect'); var isEnumerable = callBound('Object.prototype.propertyIsEnumerable'); var toLowerCase = callBound('String.prototype.toLowerCase'); -var $test = callBound('RegExp.prototype.test'); +var $exec = callBound('RegExp.prototype.exec'); var objectToString = callBound('Object.prototype.toString'); module.exports = Test; @@ -553,7 +553,7 @@ Test.prototype['throws'] = function (fn, expected, msg, extra) { var passed = caught; if (isRegExp(expected)) { - passed = $test(expected, caught && caught.error); + passed = $exec(expected, caught && caught.error) !== null; expected = String(expected); } @@ -610,7 +610,7 @@ Test.prototype.match = function match(string, regexp, msg, extra) { extra: extra }); } else { - var matches = $test(regexp, string); + 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) @@ -643,7 +643,7 @@ Test.prototype.doesNotMatch = function doesNotMatch(string, regexp, msg, extra) extra: extra }); } else { - var matches = $test(regexp, string); + 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) From 53d9e18a93addb2bf70c33cc4ffe8285233a3ad0 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Mon, 24 Jan 2022 10:10:10 -0800 Subject: [PATCH 7/8] [Tests] handle a broken error `cause` in node 16.9/16.10 --- test/error.js | 2 +- test/stackTrace.js | 8 +++++--- test/throws.js | 20 +++++++++++--------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/test/error.js b/test/error.js index 18dcb0bd..94c96ed9 100644 --- a/test/error.js +++ b/test/error.js @@ -20,7 +20,7 @@ tap.test('failures', function (tt) { ' expected: |-', ' undefined', ' actual: |-', - ' [Error: this is a message]', + ' ' + ('cause' in Error.prototype ? '{ [Error: this is a message] [cause]: undefined }' : '[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 8ae0ee6b..6061f9ca 100644 --- a/test/stackTrace.js +++ b/test/stackTrace.js @@ -14,6 +14,8 @@ 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, { @@ -24,7 +26,7 @@ tap.test('preserves stack trace with newlines', function (tt) { stack: stackTrace, operator: 'error', expected: 'undefined', - actual: '[Error: Preserve stack]' + actual: inspected } }); }); @@ -41,7 +43,7 @@ tap.test('preserves stack trace with newlines', function (tt) { + ' expected: |-\n' + ' undefined\n' + ' actual: |-\n' - + ' [Error: Preserve stack]\n' + + ' ' + inspected + '\n' + ' stack: |-\n' + ' foo\n' + ' bar\n' @@ -57,7 +59,7 @@ tap.test('preserves stack trace with newlines', function (tt) { stack: stackTrace, operator: 'error', expected: 'undefined', - actual: '[Error: Preserve stack]' + actual: inspected }); })); diff --git a/test/throws.js b/test/throws.js index 77d92cb5..a2daf100 100644 --- a/test/throws.js +++ b/test/throws.js @@ -26,6 +26,8 @@ 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')), [ @@ -37,7 +39,7 @@ tap.test('failures', function (tt) { ' expected: |-', ' undefined', ' actual: |-', - ' { [TypeError: ' + getNonFunctionMessage() + "] message: '" + getNonFunctionMessage() + "' }", + ' { [TypeError: ' + getNonFunctionMessage() + '] ' + maybeCause + "message: '" + getNonFunctionMessage() + "' }", ' at: Test. ($TEST/throws.js:$LINE:$COL)', ' stack: |-', String(' TypeError: ' + getNonFunctionMessage(undefined)), @@ -51,7 +53,7 @@ tap.test('failures', function (tt) { ' expected: |-', ' undefined', ' actual: |-', - ' { [TypeError: ' + getNonFunctionMessage(null) + "] message: '" + getNonFunctionMessage(null) + "' }", + ' { [TypeError: ' + getNonFunctionMessage(null) + '] ' + maybeCause + "message: '" + getNonFunctionMessage(null) + "' }", ' at: Test. ($TEST/throws.js:$LINE:$COL)', ' stack: |-', String(' TypeError: ' + getNonFunctionMessage(null)), @@ -65,7 +67,7 @@ tap.test('failures', function (tt) { ' expected: |-', ' undefined', ' actual: |-', - ' { [TypeError: ' + getNonFunctionMessage(true) + "] message: '" + getNonFunctionMessage(true) + "' }", + ' { [TypeError: ' + getNonFunctionMessage(true) + '] ' + maybeCause + "message: '" + getNonFunctionMessage(true) + "' }", ' at: Test. ($TEST/throws.js:$LINE:$COL)', ' stack: |-', String(' TypeError: ' + getNonFunctionMessage(true)), @@ -79,7 +81,7 @@ tap.test('failures', function (tt) { ' expected: |-', ' undefined', ' actual: |-', - ' { [TypeError: ' + getNonFunctionMessage(false) + "] message: '" + getNonFunctionMessage(false) + "' }", + ' { [TypeError: ' + getNonFunctionMessage(false) + '] ' + maybeCause + "message: '" + getNonFunctionMessage(false) + "' }", ' at: Test. ($TEST/throws.js:$LINE:$COL)', ' stack: |-', String(' TypeError: ' + getNonFunctionMessage(false)), @@ -93,7 +95,7 @@ tap.test('failures', function (tt) { ' expected: |-', ' undefined', ' actual: |-', - ' { [TypeError: ' + getNonFunctionMessage('abc') + "] message: '" + getNonFunctionMessage('abc') + "' }", + ' { [TypeError: ' + getNonFunctionMessage('abc') + '] ' + maybeCause + "message: '" + getNonFunctionMessage('abc') + "' }", ' at: Test. ($TEST/throws.js:$LINE:$COL)', ' stack: |-', String(' TypeError: ' + getNonFunctionMessage('abc')), @@ -107,7 +109,7 @@ tap.test('failures', function (tt) { ' expected: |-', ' undefined', ' actual: |-', - ' { [TypeError: ' + getNonFunctionMessage(/a/g) + "] message: '" + getNonFunctionMessage(/a/g) + "' }", + ' { [TypeError: ' + getNonFunctionMessage(/a/g) + '] ' + maybeCause + "message: '" + getNonFunctionMessage(/a/g) + "' }", ' at: Test. ($TEST/throws.js:$LINE:$COL)', ' stack: |-', String(' TypeError: ' + getNonFunctionMessage(/a/g)), @@ -121,7 +123,7 @@ tap.test('failures', function (tt) { ' expected: |-', ' undefined', ' actual: |-', - ' { [TypeError: ' + getNonFunctionMessage([]) + "] message: '" + getNonFunctionMessage([]) + "' }", + ' { [TypeError: ' + getNonFunctionMessage([]) + '] ' + maybeCause + "message: '" + getNonFunctionMessage([]) + "' }", ' at: Test. ($TEST/throws.js:$LINE:$COL)', ' stack: |-', String(' TypeError: ' + getNonFunctionMessage([])), @@ -135,7 +137,7 @@ tap.test('failures', function (tt) { ' expected: |-', ' undefined', ' actual: |-', - ' { [TypeError: ' + getNonFunctionMessage({}) + "] message: '" + getNonFunctionMessage({}) + "' }", + ' { [TypeError: ' + getNonFunctionMessage({}) + '] ' + maybeCause + "message: '" + getNonFunctionMessage({}) + "' }", ' at: Test. ($TEST/throws.js:$LINE:$COL)', ' stack: |-', String(' TypeError: ' + getNonFunctionMessage({})), @@ -169,7 +171,7 @@ tap.test('failures', function (tt) { ' expected: |-', ' [Function: TypeError]', ' actual: |-', - ' { [RangeError: actual!] ' + ('cause' in Error.prototype ? '[cause]: undefined, ' : '') + "message: 'actual!' }", + ' { [RangeError: actual!] ' + maybeCause + "message: 'actual!' }", ' at: Test. ($TEST/throws.js:$LINE:$COL)', ' stack: |-', ' RangeError: actual!', From 678b92204b606ba8e612b2487e7390d365a372ca Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Fri, 8 Apr 2022 12:08:26 -0700 Subject: [PATCH 8/8] v4.15.1 - [Robustness] `test` observably looks up `exec` on the object - [Deps] update `minimist` - [meta] ensure `prelint` works on windows - [meta] improve `prelint` script when no `.git` dir is present - [meta] remove unused travis.yml file - [Dev Deps] update `eslint`, `@ljharb/eslint-config` - [Tests] handle a broken error `cause` in node 16.9/16.10 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bc40ebf5..af8e06fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tape", - "version": "4.15.0", + "version": "4.15.1", "description": "tap-producing test harness for node and browsers", "main": "index.js", "browser": {