From 4575ca4b185cb503c93e29113b99e10f1ae4b63c Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Fri, 8 Apr 2022 14:30:56 -0700 Subject: [PATCH 1/9] [Robustness] `test` observably looks up `exec` on the object take 2 --- lib/results.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/results.js b/lib/results.js index 29d8e242..72de9ba0 100644 --- a/lib/results.js +++ b/lib/results.js @@ -8,7 +8,7 @@ var resumer = require('resumer'); var inspect = require('object-inspect'); var callBound = require('call-bind/callBound'); var has = require('has'); -var regexpTest = callBound('RegExp.prototype.test'); +var $exec = callBound('RegExp.prototype.exec'); var yamlIndicators = /:|-|\?/; var nextTick = typeof setImmediate !== 'undefined' ? setImmediate : process.nextTick; module.exports = Results; @@ -221,5 +221,5 @@ function getNextTest(results) { } function invalidYaml(str) { - return regexpTest(yamlIndicators, str); + return $exec(yamlIndicators, str) !== null; } From 7b0c901b459b19668fcf6cc5b4b08f42978135b4 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Mon, 11 Apr 2022 23:26:35 -0700 Subject: [PATCH 2/9] [meta] add SECURITY.md --- .github/SECURITY.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .github/SECURITY.md diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 00000000..82e4285a --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1,3 @@ +# Security + +Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. From f35f71bd44e76eb53bedd63615e59fdc382e4d0d Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Mon, 25 Apr 2022 15:52:36 -0700 Subject: [PATCH 3/9] [Tests] fix no_only tests on Windows --- package.json | 3 ++- test/no_only.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index af8e06fc..744bb7ae 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,8 @@ "pretest": "npm run lint", "test": "npm run tests-only", "posttest": "aud --production", - "tests-only": "nyc tap test/*.js" + "tests-only": "nyc tap 'test/*.js'", + "test:example": "find example -name '*.js' | grep -v fail | grep -v static | xargs tap" }, "testling": { "files": "test/browser/*.js", diff --git a/test/no_only.js b/test/no_only.js index 693ab110..d0f126ba 100644 --- a/test/no_only.js +++ b/test/no_only.js @@ -6,7 +6,7 @@ var exec = require('child_process').exec; var stripFullStack = require('./common').stripFullStack; -var tapeBin = path.join(__dirname, '../bin/tape'); +var tapeBin = 'node ' + path.join(__dirname, '../bin/tape'); 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 From 5b4752fe006597002918cbd3ee8a4e50f48677ca Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 3 May 2022 22:30:10 -0700 Subject: [PATCH 4/9] [meta] create FUNDING.yml --- .github/FUNDING.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..6ed04b5c --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/tape # Replace with a single tidelift name +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] From 934d49b1e840d3c57bd6e52a74017e06c6a55934 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 16 Aug 2022 13:44:07 -0700 Subject: [PATCH 5/9] [Dev Deps] update `@ljharb/eslint-config`, `array.prototype.flatmap`, `es-value-fixtures`, `falafel` --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 744bb7ae..d2dd883d 100644 --- a/package.json +++ b/package.json @@ -29,15 +29,15 @@ "through": "~2.3.8" }, "devDependencies": { - "@ljharb/eslint-config": "^20.2.3", - "array.prototype.flatmap": "^1.2.5", + "@ljharb/eslint-config": "^21.0.0", + "array.prototype.flatmap": "^1.3.0", "aud": "^2.0.0", "concat-stream": "^1.6.2", "eclint": "^2.8.1", "ecstatic": "^4.1.4", - "es-value-fixtures": "^1.2.1", + "es-value-fixtures": "^1.4.2", "eslint": "=8.8.0", - "falafel": "^2.2.4", + "falafel": "^2.2.5", "js-yaml": "^3.14.0", "npm-run-posix-or-windows": "^2.0.2", "safe-publish-latest": "^2.0.0", From 6a3c2009e7f6052bd4423dce80bb140e234a877f Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 16 Aug 2022 13:44:41 -0700 Subject: [PATCH 6/9] [Deps] update `glob`, `object-inspect`, `resolve`, `string.prototype.trim` --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index d2dd883d..a71c9d13 100644 --- a/package.json +++ b/package.json @@ -17,15 +17,15 @@ "defined": "~1.0.0", "dotignore": "~0.1.2", "for-each": "~0.3.3", - "glob": "~7.2.0", + "glob": "~7.2.3", "has": "~1.0.3", "inherits": "~2.0.4", "is-regex": "~1.1.4", "minimist": "~1.2.6", - "object-inspect": "~1.12.0", - "resolve": "~1.22.0", + "object-inspect": "~1.12.2", + "resolve": "~1.22.1", "resumer": "~0.0.0", - "string.prototype.trim": "~1.2.5", + "string.prototype.trim": "~1.2.6", "through": "~2.3.8" }, "devDependencies": { From fbdbfc90dd7afeba89cc3dd5e6280ed247f8b789 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 16 Aug 2022 13:47:46 -0700 Subject: [PATCH 7/9] [Refactor] `bin/tape`: make it a bit more functional, for easier v5 backporting --- bin/tape | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bin/tape b/bin/tape index 84f0f0ec..f774228f 100755 --- a/bin/tape +++ b/bin/tape @@ -47,7 +47,7 @@ if (typeof opts.ignore === 'string') { var glob = require('glob'); -opts._.forEach(function (arg) { +opts._.reduce(function (result, 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); @@ -55,9 +55,11 @@ opts._.forEach(function (arg) { throw new TypeError('unknown error: glob.sync did not return an array or throw. Please report this.'); } - files.filter(function (file) { return !matcher || !matcher.shouldIgnore(file); }).forEach(function (file) { - require(resolvePath(cwd, file)); - }); + return result.concat(files); +}, []).filter(function (file) { + return !matcher || !matcher.shouldIgnore(file); +}).forEach(function (file) { + require(resolvePath(cwd, file)); }); // vim: ft=javascript From 6a1ce4389e8b601249c3c81b31cd60eea3e0f74a Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Mon, 15 Aug 2022 21:57:18 -0700 Subject: [PATCH 8/9] [New] `bin/tape`: include the exact arg when there are no glob results; use require on `--require` files --- bin/tape | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/bin/tape b/bin/tape index f774228f..2783f5da 100755 --- a/bin/tape +++ b/bin/tape @@ -48,14 +48,17 @@ if (typeof opts.ignore === 'string') { var glob = require('glob'); opts._.reduce(function (result, 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(files); + } + return result.concat(arg); }, []).filter(function (file) { return !matcher || !matcher.shouldIgnore(file); }).forEach(function (file) { From f4c7214aba364b059b38289394b9c4a4c9d71a79 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 16 Aug 2022 13:56:46 -0700 Subject: [PATCH 9/9] v4.16.0 - [New] `bin/tape`: include the exact arg when there are no glob results; use require on `--require` files - [Refactor] `bin/tape`: make it a bit more functional, for easier v5 backporting - [Robustness] `test` observably looks up `exec` on the object - [meta] create FUNDING.yml - [meta] add SECURITY.md - [Deps] update `glob`, `object-inspect`, `resolve`, `string.prototype.trim` - [Dev Deps] update `@ljharb/eslint-config`, `array.prototype.flatmap`, `es-value-fixtures`, `falafel` - [Tests] fix no_only tests on Windows --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a71c9d13..baf08198 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tape", - "version": "4.15.1", + "version": "4.16.0", "description": "tap-producing test harness for node and browsers", "main": "index.js", "browser": {