From a1c5381efadbb3e1c7f6e52f41f63a1e9a362aa6 Mon Sep 17 00:00:00 2001 From: isaacs Date: Fri, 4 Mar 2022 22:48:35 -0800 Subject: [PATCH 1/2] update tap --- package-lock.json | 156 ++++++++++++---------------------------------- package.json | 2 +- 2 files changed, 42 insertions(+), 116 deletions(-) diff --git a/package-lock.json b/package-lock.json index 477a5dc..323c6c6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,7 @@ "tap-mocha-reporter": "index.js" }, "devDependencies": { - "tap": "^15.1.6" + "tap": "^15.2.2" }, "engines": { "node": ">= 8" @@ -1604,9 +1604,9 @@ } }, "node_modules/libtap": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/libtap/-/libtap-1.1.4.tgz", - "integrity": "sha512-jM+QyAeRdVs1bJrNpjlu+l8gRdDkAehqls31AwSnqXghVLUP6nbYeU2Xfs2svYS7ZdksvnHvrxCKRBFEz/BCjA==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/libtap/-/libtap-1.2.2.tgz", + "integrity": "sha512-GZWH3fipvi6Pgrpy6Bi8unioB3Vu6qQRYQ+h6NxfzwvCm5yut1j4W8AQfX9Yab03CiFGjro55G0SIp6unVdx0g==", "dev": true, "dependencies": { "async-hook-domain": "^2.0.4", @@ -1618,11 +1618,10 @@ "own-or-env": "^1.0.2", "signal-exit": "^3.0.4", "stack-utils": "^2.0.4", - "tap-parser": "^10.0.1", + "tap-parser": "^11.0.0", "tap-yaml": "^1.0.0", "tcompare": "^5.0.6", - "trivial-deferred": "^1.0.1", - "yapool": "^1.0.0" + "trivial-deferred": "^1.0.1" }, "engines": { "node": ">=10" @@ -1631,23 +1630,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/libtap/node_modules/tap-parser": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/tap-parser/-/tap-parser-10.1.0.tgz", - "integrity": "sha512-FujQeciDaOiOvaIVGS1Rpb0v4R6XkOjvWCWowlz5oKuhPkEJ8U6pxgqt38xuzYhPt8dWEnfHn2jqpZdJEkW7pA==", - "dev": true, - "dependencies": { - "events-to-array": "^1.0.1", - "minipass": "^3.0.0", - "tap-yaml": "^1.0.0" - }, - "bin": { - "tap-parser": "bin/cmd.js" - }, - "engines": { - "node": ">= 8" - } - }, "node_modules/locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -2310,9 +2292,9 @@ } }, "node_modules/tap": { - "version": "15.1.6", - "resolved": "https://registry.npmjs.org/tap/-/tap-15.1.6.tgz", - "integrity": "sha512-TN7xH6Q2tUPTd6qwmkhuFJcx1vUR8e4dDUpBKc61G0krOzne7Ia6aKIFb8O/0kVazachSSuVME1V8nQ2xwWL8w==", + "version": "15.2.2", + "resolved": "https://registry.npmjs.org/tap/-/tap-15.2.2.tgz", + "integrity": "sha512-MWU8vdFfTAWlVw73bNDgGCzZ6zHFEOprd2eywAsLJLTtr4IKjk4wWG5Qh8x2zJipKA2hEzxANqS2mJ+k2YMBbQ==", "bundleDependencies": [ "ink", "treport", @@ -2334,7 +2316,7 @@ "isexe": "^2.0.0", "istanbul-lib-processinfo": "^2.0.2", "jackspeak": "^1.4.1", - "libtap": "^1.1.4", + "libtap": "^1.2.2", "minipass": "^3.1.1", "mkdirp": "^1.0.4", "nyc": "^15.1.0", @@ -2343,8 +2325,8 @@ "rimraf": "^3.0.0", "signal-exit": "^3.0.6", "source-map-support": "^0.5.16", - "tap-mocha-reporter": "^5.0.0", - "tap-parser": "^10.0.1", + "tap-mocha-reporter": "^5.0.3", + "tap-parser": "^11.0.0", "tap-yaml": "^1.0.0", "tcompare": "^5.0.7", "treport": "*", @@ -2377,9 +2359,9 @@ } }, "node_modules/tap-mocha-reporter": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/tap-mocha-reporter/-/tap-mocha-reporter-5.0.1.tgz", - "integrity": "sha512-1knFWOwd4khx/7uSEnUeaP9IPW3w+sqTgJMhrwah6t46nZ8P25atOKAjSvVDsT67lOPu0nfdOqUwoyKn+3E5pA==", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/tap-mocha-reporter/-/tap-mocha-reporter-5.0.3.tgz", + "integrity": "sha512-6zlGkaV4J+XMRFkN0X+yuw6xHbE9jyCZ3WUKfw4KxMyRGOpYSRuuQTRJyWX88WWuLdVTuFbxzwXhXuS2XE6o0g==", "dev": true, "dependencies": { "color-support": "^1.1.0", @@ -2387,7 +2369,7 @@ "diff": "^4.0.1", "escape-string-regexp": "^2.0.0", "glob": "^7.0.5", - "tap-parser": "^10.0.0", + "tap-parser": "^11.0.0", "tap-yaml": "^1.0.0", "unicode-length": "^2.0.2" }, @@ -2398,23 +2380,6 @@ "node": ">= 8" } }, - "node_modules/tap-mocha-reporter/node_modules/tap-parser": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/tap-parser/-/tap-parser-10.1.0.tgz", - "integrity": "sha512-FujQeciDaOiOvaIVGS1Rpb0v4R6XkOjvWCWowlz5oKuhPkEJ8U6pxgqt38xuzYhPt8dWEnfHn2jqpZdJEkW7pA==", - "dev": true, - "dependencies": { - "events-to-array": "^1.0.1", - "minipass": "^3.0.0", - "tap-yaml": "^1.0.0" - }, - "bin": { - "tap-parser": "bin/cmd.js" - }, - "engines": { - "node": ">= 8" - } - }, "node_modules/tap-parser": { "version": "11.0.0", "resolved": "https://registry.npmjs.org/tap-parser/-/tap-parser-11.0.0.tgz", @@ -3631,7 +3596,7 @@ "license": "MIT" }, "node_modules/tap/node_modules/minipass": { - "version": "3.1.5", + "version": "3.1.6", "dev": true, "inBundle": true, "license": "ISC", @@ -4016,13 +3981,13 @@ } }, "node_modules/tap/node_modules/tap-parser": { - "version": "10.1.0", + "version": "11.0.0", "dev": true, "inBundle": true, "license": "MIT", "dependencies": { "events-to-array": "^1.0.1", - "minipass": "^3.0.0", + "minipass": "^3.1.6", "tap-yaml": "^1.0.0" }, "bin": { @@ -4051,7 +4016,7 @@ } }, "node_modules/tap/node_modules/treport": { - "version": "3.0.2", + "version": "3.0.3", "dev": true, "inBundle": true, "license": "ISC", @@ -4061,7 +4026,7 @@ "chalk": "^3.0.0", "ink": "^3.2.0", "ms": "^2.1.2", - "tap-parser": "^10.0.1", + "tap-parser": "^11.0.0", "unicode-length": "^2.0.2" }, "peerDependencies": { @@ -4561,12 +4526,6 @@ "node": ">= 6" } }, - "node_modules/yapool": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/yapool/-/yapool-1.0.0.tgz", - "integrity": "sha1-9pPymjFbUNmp2iZGp6ZkXJaYW2o=", - "dev": true - }, "node_modules/yargs": { "version": "15.4.1", "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", @@ -5861,9 +5820,9 @@ "dev": true }, "libtap": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/libtap/-/libtap-1.1.4.tgz", - "integrity": "sha512-jM+QyAeRdVs1bJrNpjlu+l8gRdDkAehqls31AwSnqXghVLUP6nbYeU2Xfs2svYS7ZdksvnHvrxCKRBFEz/BCjA==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/libtap/-/libtap-1.2.2.tgz", + "integrity": "sha512-GZWH3fipvi6Pgrpy6Bi8unioB3Vu6qQRYQ+h6NxfzwvCm5yut1j4W8AQfX9Yab03CiFGjro55G0SIp6unVdx0g==", "dev": true, "requires": { "async-hook-domain": "^2.0.4", @@ -5875,24 +5834,10 @@ "own-or-env": "^1.0.2", "signal-exit": "^3.0.4", "stack-utils": "^2.0.4", - "tap-parser": "^10.0.1", + "tap-parser": "^11.0.0", "tap-yaml": "^1.0.0", "tcompare": "^5.0.6", - "trivial-deferred": "^1.0.1", - "yapool": "^1.0.0" - }, - "dependencies": { - "tap-parser": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/tap-parser/-/tap-parser-10.1.0.tgz", - "integrity": "sha512-FujQeciDaOiOvaIVGS1Rpb0v4R6XkOjvWCWowlz5oKuhPkEJ8U6pxgqt38xuzYhPt8dWEnfHn2jqpZdJEkW7pA==", - "dev": true, - "requires": { - "events-to-array": "^1.0.1", - "minipass": "^3.0.0", - "tap-yaml": "^1.0.0" - } - } + "trivial-deferred": "^1.0.1" } }, "locate-path": { @@ -6403,9 +6348,9 @@ } }, "tap": { - "version": "15.1.6", - "resolved": "https://registry.npmjs.org/tap/-/tap-15.1.6.tgz", - "integrity": "sha512-TN7xH6Q2tUPTd6qwmkhuFJcx1vUR8e4dDUpBKc61G0krOzne7Ia6aKIFb8O/0kVazachSSuVME1V8nQ2xwWL8w==", + "version": "15.2.2", + "resolved": "https://registry.npmjs.org/tap/-/tap-15.2.2.tgz", + "integrity": "sha512-MWU8vdFfTAWlVw73bNDgGCzZ6zHFEOprd2eywAsLJLTtr4IKjk4wWG5Qh8x2zJipKA2hEzxANqS2mJ+k2YMBbQ==", "dev": true, "requires": { "@isaacs/import-jsx": "*", @@ -6420,7 +6365,7 @@ "isexe": "^2.0.0", "istanbul-lib-processinfo": "^2.0.2", "jackspeak": "^1.4.1", - "libtap": "^1.1.4", + "libtap": "^1.2.2", "minipass": "^3.1.1", "mkdirp": "^1.0.4", "nyc": "^15.1.0", @@ -6429,8 +6374,8 @@ "rimraf": "^3.0.0", "signal-exit": "^3.0.6", "source-map-support": "^0.5.16", - "tap-mocha-reporter": "^5.0.0", - "tap-parser": "^10.0.1", + "tap-mocha-reporter": "^5.0.3", + "tap-parser": "^11.0.0", "tap-yaml": "^1.0.0", "tcompare": "^5.0.7", "treport": "*", @@ -7220,7 +7165,7 @@ "dev": true }, "minipass": { - "version": "3.1.5", + "version": "3.1.6", "bundled": true, "dev": true, "requires": { @@ -7479,12 +7424,12 @@ } }, "tap-parser": { - "version": "10.1.0", + "version": "11.0.0", "bundled": true, "dev": true, "requires": { "events-to-array": "^1.0.1", - "minipass": "^3.0.0", + "minipass": "^3.1.6", "tap-yaml": "^1.0.0" } }, @@ -7502,7 +7447,7 @@ "dev": true }, "treport": { - "version": "3.0.2", + "version": "3.0.3", "bundled": true, "dev": true, "requires": { @@ -7511,7 +7456,7 @@ "chalk": "^3.0.0", "ink": "^3.2.0", "ms": "^2.1.2", - "tap-parser": "^10.0.1", + "tap-parser": "^11.0.0", "unicode-length": "^2.0.2" }, "dependencies": { @@ -7662,9 +7607,9 @@ } }, "tap-mocha-reporter": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/tap-mocha-reporter/-/tap-mocha-reporter-5.0.1.tgz", - "integrity": "sha512-1knFWOwd4khx/7uSEnUeaP9IPW3w+sqTgJMhrwah6t46nZ8P25atOKAjSvVDsT67lOPu0nfdOqUwoyKn+3E5pA==", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/tap-mocha-reporter/-/tap-mocha-reporter-5.0.3.tgz", + "integrity": "sha512-6zlGkaV4J+XMRFkN0X+yuw6xHbE9jyCZ3WUKfw4KxMyRGOpYSRuuQTRJyWX88WWuLdVTuFbxzwXhXuS2XE6o0g==", "dev": true, "requires": { "color-support": "^1.1.0", @@ -7672,22 +7617,9 @@ "diff": "^4.0.1", "escape-string-regexp": "^2.0.0", "glob": "^7.0.5", - "tap-parser": "^10.0.0", + "tap-parser": "^11.0.0", "tap-yaml": "^1.0.0", "unicode-length": "^2.0.2" - }, - "dependencies": { - "tap-parser": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/tap-parser/-/tap-parser-10.1.0.tgz", - "integrity": "sha512-FujQeciDaOiOvaIVGS1Rpb0v4R6XkOjvWCWowlz5oKuhPkEJ8U6pxgqt38xuzYhPt8dWEnfHn2jqpZdJEkW7pA==", - "dev": true, - "requires": { - "events-to-array": "^1.0.1", - "minipass": "^3.0.0", - "tap-yaml": "^1.0.0" - } - } } }, "tap-parser": { @@ -7924,12 +7856,6 @@ "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==" }, - "yapool": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/yapool/-/yapool-1.0.0.tgz", - "integrity": "sha1-9pPymjFbUNmp2iZGp6ZkXJaYW2o=", - "dev": true - }, "yargs": { "version": "15.4.1", "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", diff --git a/package.json b/package.json index 9462548..e2a369c 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "unicode-length": "^2.0.2" }, "devDependencies": { - "tap": "^15.1.6" + "tap": "^15.2.2" }, "bin": "index.js", "files": [ From d0bbe5b003c8089253dbbd994786d1dbdac8dc28 Mon Sep 17 00:00:00 2001 From: Vitaliy Potapov Date: Sun, 29 Jan 2023 20:28:53 +0400 Subject: [PATCH 2/2] handle error as string, #72 PR-URL: https://github.com/tapjs/tap-mocha-reporter/pull/74 Credit: @vitalets Close: #74 Reviewed-by: @isaacs --- lib/runner.js | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/lib/runner.js b/lib/runner.js index 8671360..d7c2ad9 100644 --- a/lib/runner.js +++ b/lib/runner.js @@ -296,14 +296,26 @@ function getError (result) { } if (result.diag && result.diag.error) { - err = { - name: result.diag.error.name || 'Error', - message: result.diag.error.message, - toString: function () { - return this.name + ': ' + this.message - }, - stack: result.diag.error.stack - } + // see: https://github.com/tapjs/tap-mocha-reporter/issues/72 + if (typeof result.diag.error === 'string') { + err = { + name: 'Error', + message: result.diag.error, + toString: function () { + return this.name + ': ' + this.message + }, + stack: result.diag.stack + } + } else { + err = { + name: result.diag.error.name || 'Error', + message: result.diag.error.message, + toString: function () { + return this.name + ': ' + this.message + }, + stack: result.diag.error.stack + } + } } else { err = { message: (result.name || '(unnamed error)').replace(/^Error: /, ''),