Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions lib/cli/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*/

const debug = require('debug')('mocha:cli:cli');
const symbols = require('log-symbols');
const yargs = require('yargs');
const path = require('node:path');
const {
Expand All @@ -22,7 +21,7 @@ const lookupFiles = require('./lookup-files');
const commands = require('./commands');
const pc = require('picocolors');
const {repository, homepage, version, discord} = require('../../package.json');
const {cwd} = require('../utils');
const {cwd, logSymbols} = require('../utils');

/**
* - Accepts an `Array` of arguments
Expand Down Expand Up @@ -60,7 +59,7 @@ exports.main = (argv = process.argv.slice(2), mochaArgs) => {
.fail((msg, err, yargs) => {
debug('caught error sometime before command handler: %O', err);
yargs.showHelp();
console.error(`\n${symbols.error} ${pc.red('ERROR:')} ${msg}`);
console.error(`\n${logSymbols.error} ${pc.red('ERROR:')} ${msg}`);
process.exit(1);
})
.help('help', 'Show usage information & exit')
Expand Down
4 changes: 2 additions & 2 deletions lib/cli/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
* @private
*/

const symbols = require('log-symbols');
const pc = require('picocolors');
const Mocha = require('../mocha');
const {
createUnsupportedError,
createInvalidArgumentValueError,
createMissingArgumentError
} = require('../errors');
const {logSymbols} = require('../utils');

const {
list,
Expand Down Expand Up @@ -361,7 +361,7 @@ exports.builder = yargs =>
Object.assign(argv, plugins);
} catch (err) {
// this could be a bad --require, bad reporter, ui, etc.
console.error(`\n${symbols.error} ${pc.red('ERROR:')}`, err);
console.error(`\n${logSymbols.error} ${pc.red('ERROR:')}`, err);
yargs.exit(1);
}
})
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/watch-run.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const logSymbols = require('log-symbols');
const {logSymbols} = require('../utils');
const debug = require('debug')('mocha:cli:watch');
const path = require('node:path');
const chokidar = require('chokidar');
Expand Down
5 changes: 2 additions & 3 deletions lib/reporters/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ var diff = require('diff');
var milliseconds = require('ms');
var utils = require('../utils');
var supportsColor = require('supports-color');
var symbols = require('log-symbols');
var constants = require('../runner').constants;
var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
Expand Down Expand Up @@ -101,8 +100,8 @@ exports.colors = {
*/

exports.symbols = {
ok: symbols.success,
err: symbols.error,
ok: utils.logSymbols.success,
err: utils.logSymbols.error,
dot: '.',
comma: ',',
bang: '!'
Expand Down
8 changes: 8 additions & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
var path = require('node:path');
var util = require('node:util');
var he = require('he');
var pc = require('picocolors');

const MOCHA_ID_PROP_NAME = '__mocha_id__';

Expand Down Expand Up @@ -696,3 +697,10 @@ exports.breakCircularDeps = inputObj => {
exports.isNumeric = input => {
return !isNaN(parseFloat(input));
};

exports.logSymbols = {
info: pc.blue('ℹ'),
success: pc.green('✔'),
warning: pc.yellow('⚠'),
error: pc.red('✖'),
};
45 changes: 4 additions & 41 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@
"glob": "^10.4.5",
"he": "^1.2.0",
"js-yaml": "^4.1.0",
"log-symbols": "^4.1.0",
"minimatch": "^9.0.5",
"ms": "^2.1.3",
"picocolors": "^1.1.1",
Expand Down
Loading