Skip to content

Commit 5bbd2d6

Browse files
committed
Remove log-symbols dependency
1 parent 1164b9d commit 5bbd2d6

File tree

7 files changed

+19
-51
lines changed

7 files changed

+19
-51
lines changed

lib/cli/cli.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
*/
1010

1111
const debug = require('debug')('mocha:cli:cli');
12-
const symbols = require('log-symbols');
1312
const yargs = require('yargs');
1413
const path = require('node:path');
1514
const {
@@ -22,7 +21,7 @@ const lookupFiles = require('./lookup-files');
2221
const commands = require('./commands');
2322
const pc = require('picocolors');
2423
const {repository, homepage, version, discord} = require('../../package.json');
25-
const {cwd} = require('../utils');
24+
const {cwd, logSymbols} = require('../utils');
2625

2726
/**
2827
* - Accepts an `Array` of arguments
@@ -60,7 +59,7 @@ exports.main = (argv = process.argv.slice(2), mochaArgs) => {
6059
.fail((msg, err, yargs) => {
6160
debug('caught error sometime before command handler: %O', err);
6261
yargs.showHelp();
63-
console.error(`\n${symbols.error} ${pc.red('ERROR:')} ${msg}`);
62+
console.error(`\n${logSymbols.error} ${pc.red('ERROR:')} ${msg}`);
6463
process.exit(1);
6564
})
6665
.help('help', 'Show usage information & exit')

lib/cli/run.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
* @private
88
*/
99

10-
const symbols = require('log-symbols');
1110
const pc = require('picocolors');
1211
const Mocha = require('../mocha');
1312
const {
1413
createUnsupportedError,
1514
createInvalidArgumentValueError,
1615
createMissingArgumentError
1716
} = require('../errors');
17+
const {logSymbols} = require('../utils');
1818

1919
const {
2020
list,
@@ -361,7 +361,7 @@ exports.builder = yargs =>
361361
Object.assign(argv, plugins);
362362
} catch (err) {
363363
// this could be a bad --require, bad reporter, ui, etc.
364-
console.error(`\n${symbols.error} ${pc.red('ERROR:')}`, err);
364+
console.error(`\n${logSymbols.error} ${pc.red('ERROR:')}`, err);
365365
yargs.exit(1);
366366
}
367367
})

lib/cli/watch-run.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
const logSymbols = require('log-symbols');
3+
const {logSymbols} = require('../utils');
44
const debug = require('debug')('mocha:cli:watch');
55
const path = require('node:path');
66
const chokidar = require('chokidar');

lib/reporters/base.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ var diff = require('diff');
1717
var milliseconds = require('ms');
1818
var utils = require('../utils');
1919
var supportsColor = require('supports-color');
20-
var symbols = require('log-symbols');
2120
var constants = require('../runner').constants;
2221
var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
2322
var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
@@ -101,8 +100,8 @@ exports.colors = {
101100
*/
102101

103102
exports.symbols = {
104-
ok: symbols.success,
105-
err: symbols.error,
103+
ok: utils.logSymbols.success,
104+
err: utils.logSymbols.error,
106105
dot: '.',
107106
comma: ',',
108107
bang: '!'

lib/utils.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
var path = require('node:path');
1212
var util = require('node:util');
1313
var he = require('he');
14+
var pc = require('picocolors');
1415

1516
const MOCHA_ID_PROP_NAME = '__mocha_id__';
1617

@@ -696,3 +697,10 @@ exports.breakCircularDeps = inputObj => {
696697
exports.isNumeric = input => {
697698
return !isNaN(parseFloat(input));
698699
};
700+
701+
exports.logSymbols = {
702+
info: pc.blue('ℹ'),
703+
success: pc.green('✔'),
704+
warning: pc.yellow('⚠'),
705+
error: pc.red('✖'),
706+
};

package-lock.json

Lines changed: 4 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@
106106
"glob": "^10.4.5",
107107
"he": "^1.2.0",
108108
"js-yaml": "^4.1.0",
109-
"log-symbols": "^4.1.0",
110109
"minimatch": "^9.0.5",
111110
"ms": "^2.1.3",
112111
"picocolors": "^1.1.1",

0 commit comments

Comments
 (0)