From a2e600d70f4d7ca6ba8741ebe8c70cfec438ef1b Mon Sep 17 00:00:00 2001 From: Lucas Lopes Date: Fri, 8 Mar 2024 10:14:57 -0300 Subject: [PATCH 1/4] fix: closes #5115 (#5116) Eleventy wasn't being able to parse the JSDocs for the returned type on the getFullErrorStack function. Defining it as a new type and then referencing it on the function fixes the issue --- lib/reporters/base.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/reporters/base.js b/lib/reporters/base.js index 5af6e7bd8a..e0ca5f4863 100644 --- a/lib/reporters/base.js +++ b/lib/reporters/base.js @@ -227,7 +227,7 @@ var generateDiff = (exports.generateDiff = function (actual, expected) { * @private * @param {Error} err * @param {Set} [seen] - * @return {{ message: string, msg: string, stack: string }} + * @return {FullErrorStack} */ var getFullErrorStack = function (err, seen) { if (seen && seen.has(err)) { @@ -580,3 +580,12 @@ function sameType(a, b) { Base.consoleLog = consoleLog; Base.abstract = true; + +/** + * An object with all stack traces recursively mounted from each err.cause + * @memberof module:lib/reporters/base + * @typedef {Object} FullErrorStack + * @property {string} message + * @property {string} msg + * @property {string} stack + */ From efbb147590dfd7ff290de40a9930b07334784054 Mon Sep 17 00:00:00 2001 From: Bryan Mishkin <698306+bmish@users.noreply.github.com> Date: Tue, 12 Mar 2024 23:08:19 +0800 Subject: [PATCH 2/4] feat: add file path to xunit reporter (#4985) * feat: add file path to xunit reporter * Update lib/reporters/xunit.js Co-authored-by: Ville Lahdenvuo * Revert "Update lib/reporters/xunit.js" This reverts commit 1245e7e80f3d9faed99d459dcfebdb35d31be370. --------- Co-authored-by: Ville Lahdenvuo --- lib/reporters/xunit.js | 1 + test/reporters/xunit.spec.js | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/lib/reporters/xunit.js b/lib/reporters/xunit.js index ec788c5da0..4e6fe2bcf9 100644 --- a/lib/reporters/xunit.js +++ b/lib/reporters/xunit.js @@ -158,6 +158,7 @@ XUnit.prototype.test = function (test) { var attrs = { classname: test.parent.fullTitle(), name: test.title, + file: test.file, time: test.duration / 1000 || 0 }; diff --git a/test/reporters/xunit.spec.js b/test/reporters/xunit.spec.js index a5e0f1bbeb..4e98cf6002 100644 --- a/test/reporters/xunit.spec.js +++ b/test/reporters/xunit.spec.js @@ -30,6 +30,7 @@ describe('XUnit reporter', function () { var expectedLine = 'some-line'; var expectedClassName = 'fullTitle'; var expectedTitle = 'some title'; + var expectedFile = 'testFile.spec.js'; var expectedMessage = 'some message'; var expectedDiff = '\n + expected - actual\n\n -foo\n +bar\n '; @@ -325,6 +326,7 @@ describe('XUnit reporter', function () { var expectedTest = { state: STATE_FAILED, title: expectedTitle, + file: expectedFile, parent: { fullTitle: function () { return expectedClassName; @@ -347,6 +349,8 @@ describe('XUnit reporter', function () { expectedClassName + '" name="' + expectedTitle + + '" file="' + + expectedFile + '" time="1">' + expectedMessage + '\n' + @@ -365,6 +369,7 @@ describe('XUnit reporter', function () { var expectedTest = { state: STATE_FAILED, title: expectedTitle, + file: expectedFile, parent: { fullTitle: function () { return expectedClassName; @@ -402,6 +407,7 @@ describe('XUnit reporter', function () { return true; }, title: expectedTitle, + file: expectedFile, parent: { fullTitle: function () { return expectedClassName; @@ -418,6 +424,8 @@ describe('XUnit reporter', function () { expectedClassName + '" name="' + expectedTitle + + '" file="' + + expectedFile + '" time="1">'; expect(expectedWrite, 'to be', expectedTag); }); @@ -431,6 +439,7 @@ describe('XUnit reporter', function () { return false; }, title: expectedTitle, + file: expectedFile, parent: { fullTitle: function () { return expectedClassName; @@ -447,6 +456,8 @@ describe('XUnit reporter', function () { expectedClassName + '" name="' + expectedTitle + + '" file="' + + expectedFile + '" time="0"/>'; expect(expectedWrite, 'to be', expectedTag); }); From a5b565289b40a839af086b13fb369e04e205ed4b Mon Sep 17 00:00:00 2001 From: Nathan Phillip Brink Date: Tue, 12 Mar 2024 13:18:58 -0400 Subject: [PATCH 3/4] docs: fix documentation concerning glob expansion on UNIX (#4869) --- docs/index.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/index.md b/docs/index.md index b6a70eba7c..a56b64adde 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2257,10 +2257,11 @@ Some shells support recursive matching by using the globstar (`**`) wildcard. Ba $ mocha "./spec/**/*.js" ``` -[You should _always_ quote your globs in npm scripts][article-globbing]. If you -use double quotes, it's the shell on UNIX that will expand the glob. On the -other hand, if you use single quotes, the [`node-glob`][npm-glob] module will -handle its expansion. +You should _always_ quote your globs in npm scripts. If you +use quotes, the [`node-glob`][npm-glob] module will +handle its expansion. For maximum compatibility, +surround the entire expression with double quotes and refrain +from `$`, `"`, `^`, and `\` within your expression. See this [tutorial][gist-globbing-tutorial] on using globs. @@ -2352,7 +2353,6 @@ For a running example of Mocha, view [example/tests.html](example/tests.html). F or the [source](https://github.com/mochajs/mocha/blob/master/lib/mocha.js). [//]: # 'Cross reference section' -[article-globbing]: https://medium.com/@jakubsynowiec/you-should-always-quote-your-globs-in-npm-scripts-621887a2a784 [bash-globbing]: https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html [better-assert]: https://github.com/visionmedia/better-assert [caniuse-notifications]: https://caniuse.com/#feat=notifications From 6f3f45e587a17463b75047631152429fa14b82a3 Mon Sep 17 00:00:00 2001 From: Pelle Wessman Date: Tue, 26 Mar 2024 18:00:32 +0100 Subject: [PATCH 4/4] fix: xunit integration test (#5122) --- test/integration/reporters.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/integration/reporters.spec.js b/test/integration/reporters.spec.js index cdc15b8233..08fa7f85a3 100644 --- a/test/integration/reporters.spec.js +++ b/test/integration/reporters.spec.js @@ -44,8 +44,8 @@ describe('reporters', function () { 'output=' + tmpFile ]; var expectedOutput = [ - '