mocha 10.2.0 → 10.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <p align="center">
2
- <img src="https://cldup.com/xFVFxOioAU.svg" alt="Mocha test framework"/>
2
+ <img src="https://cldup.com/xFVFxOioAU.svg" alt="Mocha test framework logo"/>
3
3
  </p>
4
4
 
5
5
  <p align="center">☕️ Simple, flexible, fun JavaScript test framework for Node.js & The Browser ☕️</p>
@@ -8,9 +8,9 @@
8
8
  <a href="https://github.com/mochajs/mocha/actions?query=workflow%3ATests+branch%3Amaster"><img src="https://github.com/mochajs/mocha/workflows/Tests/badge.svg?branch=master" alt="GitHub Actions Build Status"></a>
9
9
  <a href="https://coveralls.io/github/mochajs/mocha"><img src="https://coveralls.io/repos/github/mochajs/mocha/badge.svg" alt="Coverage Status"></a>
10
10
  <a href="https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmochajs%2Fmocha?ref=badge_shield"><img src="https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fmochajs%2Fmocha.svg?type=shield" alt="FOSSA Status"></a>
11
- <a href="https://gitter.im/mochajs/mocha?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"><img src="https://badges.gitter.im/Join%20Chat.svg" alt="Gitter"></a>
12
- <a href="https://github.com/mochajs/mocha#sponsors"><img src="https://opencollective.com/mochajs/tiers/sponsors/badge.svg" alt="OpenCollective"></a>
13
- <a href="https://github.com/mochajs/mocha#backers"><img src="https://opencollective.com/mochajs/tiers/backers/badge.svg" alt="OpenCollective"></a>
11
+ <a href="https://discord.gg/KeDn2uXhER"><img alt="Chat - Discord" src="https://img.shields.io/badge/chat-Discord-5765F2.svg" /></a>
12
+ <a href="https://github.com/mochajs/mocha#sponsors"><img src="https://opencollective.com/mochajs/tiers/sponsors/badge.svg" alt="OpenCollective Sponsors"></a>
13
+ <a href="https://github.com/mochajs/mocha#backers"><img src="https://opencollective.com/mochajs/tiers/backers/badge.svg" alt="OpenCollective Backers"></a>
14
14
  </p>
15
15
 
16
16
  <p align="center">
@@ -22,11 +22,12 @@
22
22
 
23
23
  ## Links
24
24
 
25
- - **[Documentation](https://mochajs.org/)**
25
+ - **[Documentation](https://mochajs.org)**
26
26
  - **[Release Notes / History / Changes](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)**
27
27
  - [Code of Conduct](https://github.com/mochajs/mocha/blob/master/.github/CODE_OF_CONDUCT.md)
28
28
  - [Contributing](https://github.com/mochajs/mocha/blob/master/.github/CONTRIBUTING.md)
29
- - [Gitter Chatroom](https://gitter.im/mochajs/mocha) (ask questions here!)
29
+ - [Development](https://github.com/mochajs/mocha/blob/master/.github/DEVELOPMENT.md)
30
+ - [Discord](https://discord.gg/KeDn2uXhER) (ask questions here!)
30
31
  - [Issue Tracker](https://github.com/mochajs/mocha/issues)
31
32
 
32
33
  ## Backers
@@ -37,7 +38,10 @@
37
38
 
38
39
  ## Sponsors
39
40
 
40
- Does your company use Mocha? Ask your manager or marketing team if your company would be interested in supporting our project. Support will allow the maintainers to dedicate more time for maintenance and new features for everyone. Also, your company's logo will show [on GitHub](https://github.com/mochajs/mocha#readme) and on [our site](https://mochajs.org#sponsors) - who doesn't want a little extra exposure? [Here's the info](https://opencollective.com/mochajs).
41
+ Does your company use Mocha? Ask your manager or marketing team if your company would be interested in supporting our project.
42
+ Support will allow the maintainers to dedicate more time for maintenance and new features for everyone.
43
+ Also, your company's logo will show [on GitHub](https://github.com/mochajs/mocha#readme) and on [our site](https://mochajs.org#sponsors) - who doesn't want a little extra exposure?
44
+ [Here's the info](https://opencollective.com/mochajs).
41
45
 
42
46
  [![MochaJS Sponsor](https://opencollective.com/mochajs/tiers/sponsors/0/avatar)](https://opencollective.com/mochajs/tiers/sponsors/0/website)
43
47
  [![MochaJS Sponsor](https://opencollective.com/mochajs/tiers/sponsors/1/avatar)](https://opencollective.com/mochajs/tiers/sponsors/1/website)
@@ -53,11 +57,11 @@ You might want to know that:
53
57
 
54
58
  You might want to help:
55
59
 
56
- - New to contributing to Mocha? Check out this list of [good first issues](https://github.com/mochajs/mocha/issues?q=is%3Aissue+is%3Aopen+label%3Agood-first-issue)
57
- - Mocha could use a hand with [these issues](https://github.com/mochajs/mocha/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
60
+ - New to contributing to Mocha? Check out this list of [good first issues](https://github.com/mochajs/mocha/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)
61
+ - Mocha could use a hand with [these issues](https://github.com/mochajs/mocha/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22)
58
62
  - The [maintainer's handbook](https://github.com/mochajs/mocha/blob/master/MAINTAINERS.md) explains how things get done
59
63
 
60
- Finally, come [chat with the maintainers](https://gitter.im/mochajs/contributors) on Gitter if you want to help with:
64
+ Finally, come [chat with the maintainers on Discord](https://discord.gg/KeDn2uXhER) if you want to help with:
61
65
 
62
66
  - Triaging issues, answering questions
63
67
  - Review, merging, and closing pull requests
package/lib/cli/cli.js CHANGED
@@ -23,7 +23,7 @@ const {
23
23
  const lookupFiles = require('./lookup-files');
24
24
  const commands = require('./commands');
25
25
  const ansi = require('ansi-colors');
26
- const {repository, homepage, version, gitter} = require('../../package.json');
26
+ const {repository, homepage, version, discord} = require('../../package.json');
27
27
  const {cwd} = require('../utils');
28
28
 
29
29
  /**
@@ -68,7 +68,7 @@ exports.main = (argv = process.argv.slice(2), mochaArgs) => {
68
68
  .wrap(process.stdout.columns ? Math.min(process.stdout.columns, 80) : 80)
69
69
  .epilog(
70
70
  `Mocha Resources
71
- Chat: ${ansi.magenta(gitter)}
71
+ Chat: ${ansi.magenta(discord)}
72
72
  GitHub: ${ansi.blue(repository.url)}
73
73
  Docs: ${ansi.yellow(homepage)}
74
74
  `
@@ -35,7 +35,10 @@ module.exports = ({
35
35
  try {
36
36
  const moreSpecFiles = castArray(lookupFiles(arg, extension, recursive))
37
37
  .filter(filename =>
38
- ignore.every(pattern => !minimatch(filename, pattern))
38
+ ignore.every(
39
+ pattern =>
40
+ !minimatch(filename, pattern, {windowsPathsNoEscape: true})
41
+ )
39
42
  )
40
43
  .map(filename => path.resolve(filename));
41
44
  return [...specFiles, ...moreSpecFiles];
@@ -75,7 +75,7 @@ module.exports = function lookupFiles(
75
75
 
76
76
  if (!fs.existsSync(filepath)) {
77
77
  let pattern;
78
- if (glob.hasMagic(filepath)) {
78
+ if (glob.hasMagic(filepath, {windowsPathsNoEscape: true})) {
79
79
  // Handle glob as is without extensions
80
80
  pattern = filepath;
81
81
  } else {
@@ -86,7 +86,12 @@ module.exports = function lookupFiles(
86
86
  pattern = `${filepath}+(${strExtensions})`;
87
87
  debug('looking for files using glob pattern: %s', pattern);
88
88
  }
89
- files.push(...glob.sync(pattern, {nodir: true}));
89
+ files.push(
90
+ ...glob.sync(pattern, {
91
+ nodir: true,
92
+ windowsPathsNoEscape: true
93
+ })
94
+ );
90
95
  if (!files.length) {
91
96
  throw createNoFilesMatchPatternError(
92
97
  `Cannot find any files matching pattern "${filepath}"`,
@@ -66,7 +66,7 @@ function NyanCat(runner, options) {
66
66
  runner.once(EVENT_RUN_END, function () {
67
67
  Base.cursor.show();
68
68
  for (var i = 0; i < self.numberOfLines; i++) {
69
- write('\n');
69
+ process.stdout.write('\n');
70
70
  }
71
71
  self.epilogue();
72
72
  });
@@ -102,15 +102,15 @@ NyanCat.prototype.drawScoreboard = function () {
102
102
  var stats = this.stats;
103
103
 
104
104
  function draw(type, n) {
105
- write(' ');
106
- write(Base.color(type, n));
107
- write('\n');
105
+ process.stdout.write(' ');
106
+ process.stdout.write(Base.color(type, n));
107
+ process.stdout.write('\n');
108
108
  }
109
109
 
110
110
  draw('green', stats.passes);
111
111
  draw('fail', stats.failures);
112
112
  draw('pending', stats.pending);
113
- write('\n');
113
+ process.stdout.write('\n');
114
114
 
115
115
  this.cursorUp(this.numberOfLines);
116
116
  };
@@ -144,9 +144,9 @@ NyanCat.prototype.drawRainbow = function () {
144
144
  var self = this;
145
145
 
146
146
  this.trajectories.forEach(function (line) {
147
- write('\u001b[' + self.scoreboardWidth + 'C');
148
- write(line.join(''));
149
- write('\n');
147
+ process.stdout.write('\u001b[' + self.scoreboardWidth + 'C');
148
+ process.stdout.write(line.join(''));
149
+ process.stdout.write('\n');
150
150
  });
151
151
 
152
152
  this.cursorUp(this.numberOfLines);
@@ -163,25 +163,25 @@ NyanCat.prototype.drawNyanCat = function () {
163
163
  var dist = '\u001b[' + startWidth + 'C';
164
164
  var padding = '';
165
165
 
166
- write(dist);
167
- write('_,------,');
168
- write('\n');
166
+ process.stdout.write(dist);
167
+ process.stdout.write('_,------,');
168
+ process.stdout.write('\n');
169
169
 
170
- write(dist);
170
+ process.stdout.write(dist);
171
171
  padding = self.tick ? ' ' : ' ';
172
- write('_|' + padding + '/\\_/\\ ');
173
- write('\n');
172
+ process.stdout.write('_|' + padding + '/\\_/\\ ');
173
+ process.stdout.write('\n');
174
174
 
175
- write(dist);
175
+ process.stdout.write(dist);
176
176
  padding = self.tick ? '_' : '__';
177
177
  var tail = self.tick ? '~' : '^';
178
- write(tail + '|' + padding + this.face() + ' ');
179
- write('\n');
178
+ process.stdout.write(tail + '|' + padding + this.face() + ' ');
179
+ process.stdout.write('\n');
180
180
 
181
- write(dist);
181
+ process.stdout.write(dist);
182
182
  padding = self.tick ? ' ' : ' ';
183
- write(padding + '"" "" ');
184
- write('\n');
183
+ process.stdout.write(padding + '"" "" ');
184
+ process.stdout.write('\n');
185
185
 
186
186
  this.cursorUp(this.numberOfLines);
187
187
  };
@@ -213,7 +213,7 @@ NyanCat.prototype.face = function () {
213
213
  */
214
214
 
215
215
  NyanCat.prototype.cursorUp = function (n) {
216
- write('\u001b[' + n + 'A');
216
+ process.stdout.write('\u001b[' + n + 'A');
217
217
  };
218
218
 
219
219
  /**
@@ -224,7 +224,7 @@ NyanCat.prototype.cursorUp = function (n) {
224
224
  */
225
225
 
226
226
  NyanCat.prototype.cursorDown = function (n) {
227
- write('\u001b[' + n + 'B');
227
+ process.stdout.write('\u001b[' + n + 'B');
228
228
  };
229
229
 
230
230
  /**
@@ -264,13 +264,4 @@ NyanCat.prototype.rainbowify = function (str) {
264
264
  return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m';
265
265
  };
266
266
 
267
- /**
268
- * Stdout helper.
269
- *
270
- * @param {string} string A message to write to stdout.
271
- */
272
- function write(string) {
273
- process.stdout.write(string);
274
- }
275
-
276
267
  NyanCat.description = '"nyan cat"';
package/lib/runnable.js CHANGED
@@ -211,7 +211,7 @@ Runnable.prototype.fullTitle = function () {
211
211
  *
212
212
  * @memberof Mocha.Runnable
213
213
  * @public
214
- * @return {string}
214
+ * @return {string[]}
215
215
  */
216
216
  Runnable.prototype.titlePath = function () {
217
217
  return this.parent.titlePath().concat([this.title]);
package/lib/suite.js CHANGED
@@ -387,7 +387,7 @@ Suite.prototype.fullTitle = function () {
387
387
  *
388
388
  * @memberof Suite
389
389
  * @public
390
- * @return {string}
390
+ * @return {string[]}
391
391
  */
392
392
  Suite.prototype.titlePath = function () {
393
393
  var result = [];
package/lib/utils.js CHANGED
@@ -8,8 +8,6 @@
8
8
  /**
9
9
  * Module dependencies.
10
10
  */
11
-
12
- const {nanoid} = require('nanoid/non-secure');
13
11
  var path = require('path');
14
12
  var util = require('util');
15
13
  var he = require('he');
@@ -615,11 +613,22 @@ exports.constants = exports.defineConstants({
615
613
  MOCHA_ID_PROP_NAME
616
614
  });
617
615
 
616
+ const uniqueIDBase =
617
+ 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_';
618
+
618
619
  /**
619
620
  * Creates a new unique identifier
621
+ * Does not create cryptographically safe ids.
622
+ * Trivial copy of nanoid/non-secure
620
623
  * @returns {string} Unique identifier
621
624
  */
622
- exports.uniqueID = () => nanoid();
625
+ exports.uniqueID = () => {
626
+ let id = '';
627
+ for (let i = 0; i < 21; i++) {
628
+ id += uniqueIDBase[(Math.random() * 64) | 0];
629
+ }
630
+ return id;
631
+ };
623
632
 
624
633
  exports.assignNewMochaID = obj => {
625
634
  const id = exports.uniqueID();
package/mocha.js CHANGED
@@ -1,4 +1,4 @@
1
- // mocha@10.2.0 in javascript ES2018
1
+ // mocha@10.3.0 in javascript ES2018
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -972,6 +972,11 @@
972
972
  ? global$2.TYPED_ARRAY_SUPPORT
973
973
  : true;
974
974
 
975
+ /*
976
+ * Export kMaxLength after typed array support is determined.
977
+ */
978
+ kMaxLength$1();
979
+
975
980
  function kMaxLength$1 () {
976
981
  return Buffer$1.TYPED_ARRAY_SUPPORT
977
982
  ? 0x7fffffff
@@ -8722,6 +8727,11 @@
8722
8727
  ? global$1.TYPED_ARRAY_SUPPORT
8723
8728
  : true;
8724
8729
 
8730
+ /*
8731
+ * Export kMaxLength after typed array support is determined.
8732
+ */
8733
+ kMaxLength();
8734
+
8725
8735
  function kMaxLength () {
8726
8736
  return Buffer.TYPED_ARRAY_SUPPORT
8727
8737
  ? 0x7fffffff
@@ -8813,6 +8823,8 @@
8813
8823
  if (Buffer.TYPED_ARRAY_SUPPORT) {
8814
8824
  Buffer.prototype.__proto__ = Uint8Array.prototype;
8815
8825
  Buffer.__proto__ = Uint8Array;
8826
+ if (typeof Symbol !== 'undefined' && Symbol.species &&
8827
+ Buffer[Symbol.species] === Buffer) ;
8816
8828
  }
8817
8829
 
8818
8830
  function assertSize (size) {
@@ -10456,28 +10468,6 @@
10456
10468
 
10457
10469
  var utils$3 = {};
10458
10470
 
10459
- let urlAlphabet =
10460
- 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
10461
- let customAlphabet = (alphabet, defaultSize = 21) => {
10462
- return (size = defaultSize) => {
10463
- let id = '';
10464
- let i = size;
10465
- while (i--) {
10466
- id += alphabet[(Math.random() * alphabet.length) | 0];
10467
- }
10468
- return id
10469
- }
10470
- };
10471
- let nanoid = (size = 21) => {
10472
- let id = '';
10473
- let i = size;
10474
- while (i--) {
10475
- id += urlAlphabet[(Math.random() * 64) | 0];
10476
- }
10477
- return id
10478
- };
10479
- var nonSecure = { nanoid, customAlphabet };
10480
-
10481
10471
  var he = {exports: {}};
10482
10472
 
10483
10473
  /*! https://mths.be/he v1.2.0 by @mathias | MIT license */
@@ -10831,8 +10821,6 @@
10831
10821
  /**
10832
10822
  * Module dependencies.
10833
10823
  */
10834
-
10835
- const {nanoid} = nonSecure;
10836
10824
  var path = require$$1;
10837
10825
  var util = require$$0$1;
10838
10826
  var he$1 = he.exports;
@@ -11438,11 +11426,22 @@
11438
11426
  MOCHA_ID_PROP_NAME
11439
11427
  });
11440
11428
 
11429
+ const uniqueIDBase =
11430
+ 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_';
11431
+
11441
11432
  /**
11442
11433
  * Creates a new unique identifier
11434
+ * Does not create cryptographically safe ids.
11435
+ * Trivial copy of nanoid/non-secure
11443
11436
  * @returns {string} Unique identifier
11444
11437
  */
11445
- exports.uniqueID = () => nanoid();
11438
+ exports.uniqueID = () => {
11439
+ let id = '';
11440
+ for (let i = 0; i < 21; i++) {
11441
+ id += uniqueIDBase[(Math.random() * 64) | 0];
11442
+ }
11443
+ return id;
11444
+ };
11446
11445
 
11447
11446
  exports.assignNewMochaID = obj => {
11448
11447
  const id = exports.uniqueID();
@@ -12969,7 +12968,7 @@
12969
12968
  *
12970
12969
  * @memberof Mocha.Runnable
12971
12970
  * @public
12972
- * @return {string}
12971
+ * @return {string[]}
12973
12972
  */
12974
12973
  Runnable$3.prototype.titlePath = function () {
12975
12974
  return this.parent.titlePath().concat([this.title]);
@@ -13712,7 +13711,7 @@
13712
13711
  *
13713
13712
  * @memberof Suite
13714
13713
  * @public
13715
- * @return {string}
13714
+ * @return {string[]}
13716
13715
  */
13717
13716
  Suite.prototype.titlePath = function () {
13718
13717
  var result = [];
@@ -17296,7 +17295,7 @@
17296
17295
  runner.once(EVENT_RUN_END, function () {
17297
17296
  Base.cursor.show();
17298
17297
  for (var i = 0; i < self.numberOfLines; i++) {
17299
- write('\n');
17298
+ process.stdout.write('\n');
17300
17299
  }
17301
17300
  self.epilogue();
17302
17301
  });
@@ -17332,15 +17331,15 @@
17332
17331
  var stats = this.stats;
17333
17332
 
17334
17333
  function draw(type, n) {
17335
- write(' ');
17336
- write(Base.color(type, n));
17337
- write('\n');
17334
+ process.stdout.write(' ');
17335
+ process.stdout.write(Base.color(type, n));
17336
+ process.stdout.write('\n');
17338
17337
  }
17339
17338
 
17340
17339
  draw('green', stats.passes);
17341
17340
  draw('fail', stats.failures);
17342
17341
  draw('pending', stats.pending);
17343
- write('\n');
17342
+ process.stdout.write('\n');
17344
17343
 
17345
17344
  this.cursorUp(this.numberOfLines);
17346
17345
  };
@@ -17374,9 +17373,9 @@
17374
17373
  var self = this;
17375
17374
 
17376
17375
  this.trajectories.forEach(function (line) {
17377
- write('\u001b[' + self.scoreboardWidth + 'C');
17378
- write(line.join(''));
17379
- write('\n');
17376
+ process.stdout.write('\u001b[' + self.scoreboardWidth + 'C');
17377
+ process.stdout.write(line.join(''));
17378
+ process.stdout.write('\n');
17380
17379
  });
17381
17380
 
17382
17381
  this.cursorUp(this.numberOfLines);
@@ -17393,25 +17392,25 @@
17393
17392
  var dist = '\u001b[' + startWidth + 'C';
17394
17393
  var padding = '';
17395
17394
 
17396
- write(dist);
17397
- write('_,------,');
17398
- write('\n');
17395
+ process.stdout.write(dist);
17396
+ process.stdout.write('_,------,');
17397
+ process.stdout.write('\n');
17399
17398
 
17400
- write(dist);
17399
+ process.stdout.write(dist);
17401
17400
  padding = self.tick ? ' ' : ' ';
17402
- write('_|' + padding + '/\\_/\\ ');
17403
- write('\n');
17401
+ process.stdout.write('_|' + padding + '/\\_/\\ ');
17402
+ process.stdout.write('\n');
17404
17403
 
17405
- write(dist);
17404
+ process.stdout.write(dist);
17406
17405
  padding = self.tick ? '_' : '__';
17407
17406
  var tail = self.tick ? '~' : '^';
17408
- write(tail + '|' + padding + this.face() + ' ');
17409
- write('\n');
17407
+ process.stdout.write(tail + '|' + padding + this.face() + ' ');
17408
+ process.stdout.write('\n');
17410
17409
 
17411
- write(dist);
17410
+ process.stdout.write(dist);
17412
17411
  padding = self.tick ? ' ' : ' ';
17413
- write(padding + '"" "" ');
17414
- write('\n');
17412
+ process.stdout.write(padding + '"" "" ');
17413
+ process.stdout.write('\n');
17415
17414
 
17416
17415
  this.cursorUp(this.numberOfLines);
17417
17416
  };
@@ -17443,7 +17442,7 @@
17443
17442
  */
17444
17443
 
17445
17444
  NyanCat.prototype.cursorUp = function (n) {
17446
- write('\u001b[' + n + 'A');
17445
+ process.stdout.write('\u001b[' + n + 'A');
17447
17446
  };
17448
17447
 
17449
17448
  /**
@@ -17454,7 +17453,7 @@
17454
17453
  */
17455
17454
 
17456
17455
  NyanCat.prototype.cursorDown = function (n) {
17457
- write('\u001b[' + n + 'B');
17456
+ process.stdout.write('\u001b[' + n + 'B');
17458
17457
  };
17459
17458
 
17460
17459
  /**
@@ -17494,15 +17493,6 @@
17494
17493
  return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m';
17495
17494
  };
17496
17495
 
17497
- /**
17498
- * Stdout helper.
17499
- *
17500
- * @param {string} string A message to write to stdout.
17501
- */
17502
- function write(string) {
17503
- process.stdout.write(string);
17504
- }
17505
-
17506
17496
  NyanCat.description = '"nyan cat"';
17507
17497
  }(nyan));
17508
17498
 
@@ -19076,7 +19066,7 @@
19076
19066
  };
19077
19067
 
19078
19068
  var name = "mocha";
19079
- var version = "10.2.0";
19069
+ var version = "10.3.0";
19080
19070
  var homepage = "https://mochajs.org/";
19081
19071
  var notifyLogo = "https://ibin.co/4QuRuGjXvl36.png";
19082
19072
  var require$$17 = {