mocha 12.0.0-beta-7 → 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
+ };