Skip to content

Commit

Permalink
Merge branch 'master' into bugfix-typescript-errors-not-outputted
Browse files Browse the repository at this point in the history
  • Loading branch information
voxpelli authored Mar 26, 2024
2 parents 9a65149 + 6f3f45e commit b264a59
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 8 deletions.
10 changes: 5 additions & 5 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion lib/reporters/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ var generateDiff = (exports.generateDiff = function (actual, expected) {
* @private
* @param {Error} err
* @param {Set<Error>} [seen]
* @return {{ message: string, msg: string, stack: string }}
* @return {FullErrorStack}
*/
var getFullErrorStack = function (err, seen) {
if (seen && seen.has(err)) {
Expand Down Expand Up @@ -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
*/
1 change: 1 addition & 0 deletions lib/reporters/xunit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand Down
4 changes: 2 additions & 2 deletions test/integration/reporters.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ describe('reporters', function () {
'output=' + tmpFile
];
var expectedOutput = [
'<testcase classname="suite" name="test1" time="',
'<testcase classname="suite" name="test2" time="',
'<testcase classname="suite" name="test1" file="',
'<testcase classname="suite" name="test2" file="',
'</testsuite>'
];

Expand Down
11 changes: 11 additions & 0 deletions test/reporters/xunit.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ';
Expand Down Expand Up @@ -325,6 +326,7 @@ describe('XUnit reporter', function () {
var expectedTest = {
state: STATE_FAILED,
title: expectedTitle,
file: expectedFile,
parent: {
fullTitle: function () {
return expectedClassName;
Expand All @@ -347,6 +349,8 @@ describe('XUnit reporter', function () {
expectedClassName +
'" name="' +
expectedTitle +
'" file="' +
expectedFile +
'" time="1"><failure>' +
expectedMessage +
'\n' +
Expand All @@ -365,6 +369,7 @@ describe('XUnit reporter', function () {
var expectedTest = {
state: STATE_FAILED,
title: expectedTitle,
file: expectedFile,
parent: {
fullTitle: function () {
return expectedClassName;
Expand Down Expand Up @@ -402,6 +407,7 @@ describe('XUnit reporter', function () {
return true;
},
title: expectedTitle,
file: expectedFile,
parent: {
fullTitle: function () {
return expectedClassName;
Expand All @@ -418,6 +424,8 @@ describe('XUnit reporter', function () {
expectedClassName +
'" name="' +
expectedTitle +
'" file="' +
expectedFile +
'" time="1"><skipped/></testcase>';
expect(expectedWrite, 'to be', expectedTag);
});
Expand All @@ -431,6 +439,7 @@ describe('XUnit reporter', function () {
return false;
},
title: expectedTitle,
file: expectedFile,
parent: {
fullTitle: function () {
return expectedClassName;
Expand All @@ -447,6 +456,8 @@ describe('XUnit reporter', function () {
expectedClassName +
'" name="' +
expectedTitle +
'" file="' +
expectedFile +
'" time="0"/>';
expect(expectedWrite, 'to be', expectedTag);
});
Expand Down

0 comments on commit b264a59

Please sign in to comment.