mocha 12.0.0-beta-8 → 12.0.0-beta-9

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/lib/cli/cli.js CHANGED
@@ -9,7 +9,6 @@
9
9
  */
10
10
 
11
11
  const debug = require("debug")("mocha:cli:cli");
12
- const symbols = require("log-symbols");
13
12
  const yargs = require("yargs");
14
13
  const path = require("node:path");
15
14
  const {
@@ -27,7 +26,7 @@ const {
27
26
  version,
28
27
  discord,
29
28
  } = require("../../package.json");
30
- const { cwd } = require("../utils");
29
+ const { cwd, logSymbols } = require("../utils");
31
30
 
32
31
  /**
33
32
  * - Accepts an `Array` of arguments
@@ -65,7 +64,7 @@ exports.main = (argv = process.argv.slice(2), mochaArgs) => {
65
64
  .fail((msg, err, yargs) => {
66
65
  debug("caught error sometime before command handler: %O", err);
67
66
  yargs.showHelp();
68
- console.error(`\n${symbols.error} ${pc.red("ERROR:")} ${msg}`);
67
+ console.error(`\n${logSymbols.error} ${pc.red("ERROR:")} ${msg}`);
69
68
  if (!msg) {
70
69
  // Log raw error and stack when an unexpected error is encountered, to
71
70
  // make debugging easier (instead of an inactionable "ERROR: null").
package/lib/cli/run.js CHANGED
@@ -7,7 +7,6 @@
7
7
  * @private
8
8
  */
9
9
 
10
- const symbols = require("log-symbols");
11
10
  const pc = require("picocolors");
12
11
  const Mocha = require("../mocha");
13
12
  const {
@@ -26,7 +25,7 @@ const { ONE_AND_DONES, ONE_AND_DONE_ARGS } = require("./one-and-dones");
26
25
  const debug = require("debug")("mocha:cli:run");
27
26
  const defaults = require("../mocharc.json");
28
27
  const { types, aliases } = require("./run-option-metadata");
29
- const { isCI } = require("../utils");
28
+ const { isCI, logSymbols } = require("../utils");
30
29
 
31
30
  /**
32
31
  * Logical option groups
@@ -359,7 +358,7 @@ exports.builder = (yargs) =>
359
358
  Object.assign(argv, plugins);
360
359
  } catch (err) {
361
360
  // this could be a bad --require, bad reporter, ui, etc.
362
- console.error(`\n${symbols.error} ${pc.red("ERROR:")}`, err);
361
+ console.error(`\n${logSymbols.error} ${pc.red("ERROR:")}`, err);
363
362
  yargs.exit(1);
364
363
  }
365
364
  })
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- const logSymbols = require("log-symbols");
4
3
  const debug = require("debug")("mocha:cli:watch");
5
4
  const path = require("node:path");
6
5
  const chokidar = require("chokidar");
@@ -9,6 +8,7 @@ const isPathInside = require("is-path-inside");
9
8
  const { minimatch } = require("minimatch");
10
9
  const Context = require("../context");
11
10
  const collectFiles = require("./collect-files");
11
+ const { logSymbols } = require("../utils");
12
12
 
13
13
  /**
14
14
  * @typedef {import('chokidar').FSWatcher} FSWatcher
@@ -17,7 +17,6 @@ var diff = require("diff");
17
17
  var milliseconds = require("ms");
18
18
  var utils = require("../utils");
19
19
  var supportsColor = require("supports-color");
20
- var symbols = require("log-symbols");
21
20
  var constants = require("../runner").constants;
22
21
  var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
23
22
  var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
@@ -101,8 +100,8 @@ exports.colors = {
101
100
  */
102
101
 
103
102
  exports.symbols = {
104
- ok: symbols.success,
105
- err: symbols.error,
103
+ ok: utils.logSymbols.success,
104
+ err: utils.logSymbols.error,
106
105
  dot: ".",
107
106
  comma: ",",
108
107
  bang: "!",
package/lib/utils.js CHANGED
@@ -11,6 +11,8 @@
11
11
  var path = require("node:path");
12
12
  var util = require("node:util");
13
13
  var he = require("he");
14
+ var pc = require("picocolors");
15
+ var isUnicodeSupported = require("is-unicode-supported")();
14
16
 
15
17
  const MOCHA_ID_PROP_NAME = "__mocha_id__";
16
18
 
@@ -711,3 +713,10 @@ exports.isNumeric = (input) => {
711
713
  exports.isCI = () => {
712
714
  return !!process.env.CI;
713
715
  };
716
+
717
+ exports.logSymbols = {
718
+ info: pc.blue(isUnicodeSupported ? "ℹ" : "i"),
719
+ success: pc.green(isUnicodeSupported ? "✔" : "√"),
720
+ warning: pc.yellow(isUnicodeSupported ? "⚠" : "‼"),
721
+ error: pc.red(isUnicodeSupported ? "✖" : "×"),
722
+ };
package/mocha.js CHANGED
@@ -1,4 +1,4 @@
1
- // mocha@12.0.0-beta-8 in javascript ES2018
1
+ // mocha@12.0.0-beta-9 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) :
@@ -179,7 +179,7 @@
179
179
  };
180
180
  var title = 'browser';
181
181
  var platform = 'browser';
182
- var browser$2 = true;
182
+ var browser$1 = true;
183
183
  var env = {};
184
184
  var argv = [];
185
185
  var version = ''; // empty string to avoid regexp issues
@@ -243,7 +243,7 @@
243
243
  var browser$1$1 = {
244
244
  nextTick: nextTick,
245
245
  title: title,
246
- browser: browser$2,
246
+ browser: browser$1,
247
247
  env: env,
248
248
  argv: argv,
249
249
  version: version,
@@ -8571,6 +8571,41 @@
8571
8571
  return he$1.exports;
8572
8572
  }
8573
8573
 
8574
+ var picocolors_browser = {exports: {}};
8575
+
8576
+ var hasRequiredPicocolors_browser;
8577
+
8578
+ function requirePicocolors_browser () {
8579
+ if (hasRequiredPicocolors_browser) return picocolors_browser.exports;
8580
+ hasRequiredPicocolors_browser = 1;
8581
+ var x=String;
8582
+ var create=function() {return {isColorSupported:false,reset:x,bold:x,dim:x,italic:x,underline:x,inverse:x,hidden:x,strikethrough:x,black:x,red:x,green:x,yellow:x,blue:x,magenta:x,cyan:x,white:x,gray:x,bgBlack:x,bgRed:x,bgGreen:x,bgYellow:x,bgBlue:x,bgMagenta:x,bgCyan:x,bgWhite:x,blackBright:x,redBright:x,greenBright:x,yellowBright:x,blueBright:x,magentaBright:x,cyanBright:x,whiteBright:x,bgBlackBright:x,bgRedBright:x,bgGreenBright:x,bgYellowBright:x,bgBlueBright:x,bgMagentaBright:x,bgCyanBright:x,bgWhiteBright:x}};
8583
+ picocolors_browser.exports=create();
8584
+ picocolors_browser.exports.createColors = create;
8585
+ return picocolors_browser.exports;
8586
+ }
8587
+
8588
+ var isUnicodeSupported;
8589
+ var hasRequiredIsUnicodeSupported;
8590
+
8591
+ function requireIsUnicodeSupported () {
8592
+ if (hasRequiredIsUnicodeSupported) return isUnicodeSupported;
8593
+ hasRequiredIsUnicodeSupported = 1;
8594
+
8595
+ isUnicodeSupported = () => {
8596
+ if (browser$1$1.platform !== 'win32') {
8597
+ return true;
8598
+ }
8599
+
8600
+ return Boolean(browser$1$1.env.CI) ||
8601
+ Boolean(browser$1$1.env.WT_SESSION) || // Windows Terminal
8602
+ browser$1$1.env.TERM_PROGRAM === 'vscode' ||
8603
+ browser$1$1.env.TERM === 'xterm-256color' ||
8604
+ browser$1$1.env.TERM === 'alacritty';
8605
+ };
8606
+ return isUnicodeSupported;
8607
+ }
8608
+
8574
8609
  var hasRequiredUtils;
8575
8610
 
8576
8611
  function requireUtils () {
@@ -8589,6 +8624,8 @@
8589
8624
  var path = require$$1;
8590
8625
  var util = require$$0$1;
8591
8626
  var he = requireHe();
8627
+ var pc = /*@__PURE__*/ requirePicocolors_browser();
8628
+ var isUnicodeSupported = requireIsUnicodeSupported()();
8592
8629
 
8593
8630
  const MOCHA_ID_PROP_NAME = "__mocha_id__";
8594
8631
 
@@ -9288,6 +9325,13 @@
9288
9325
  */
9289
9326
  exports.isCI = () => {
9290
9327
  return !!browser$1$1.env.CI;
9328
+ };
9329
+
9330
+ exports.logSymbols = {
9331
+ info: pc.blue(isUnicodeSupported ? "ℹ" : "i"),
9332
+ success: pc.green(isUnicodeSupported ? "✔" : "√"),
9333
+ warning: pc.yellow(isUnicodeSupported ? "⚠" : "‼"),
9334
+ error: pc.red(isUnicodeSupported ? "✖" : "×"),
9291
9335
  };
9292
9336
  } (utils));
9293
9337
  return utils;
@@ -9302,22 +9346,6 @@
9302
9346
 
9303
9347
  var require$$18 = /*@__PURE__*/getAugmentedNamespace(_nodeResolve_empty$1);
9304
9348
 
9305
- var browser$1;
9306
- var hasRequiredBrowser$1;
9307
-
9308
- function requireBrowser$1 () {
9309
- if (hasRequiredBrowser$1) return browser$1;
9310
- hasRequiredBrowser$1 = 1;
9311
-
9312
- browser$1 = {
9313
- info: 'ℹ️',
9314
- success: '✅',
9315
- warning: '⚠️',
9316
- error: '❌️'
9317
- };
9318
- return browser$1;
9319
- }
9320
-
9321
9349
  var require$$0 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_events);
9322
9350
 
9323
9351
  var pending;
@@ -13390,7 +13418,6 @@
13390
13418
  var milliseconds = requireMs$1();
13391
13419
  var utils = requireUtils();
13392
13420
  var supportsColor = require$$18;
13393
- var symbols = requireBrowser$1();
13394
13421
  var constants = requireRunner().constants;
13395
13422
  var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
13396
13423
  var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
@@ -13474,8 +13501,8 @@
13474
13501
  */
13475
13502
 
13476
13503
  exports.symbols = {
13477
- ok: symbols.success,
13478
- err: symbols.error,
13504
+ ok: utils.logSymbols.success,
13505
+ err: utils.logSymbols.error,
13479
13506
  dot: ".",
13480
13507
  comma: ",",
13481
13508
  bang: "!",