Skip to content

Commit 8f07c41

Browse files
author
Thomas
committed
Improve use of for...of loop to enable / disable colors. Removed chalk and colors when throwing bable-config error
1 parent 931501a commit 8f07c41

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

lib/babel-config.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
'use strict';
22
const path = require('path');
3-
const chalk = require('chalk');
43
const figures = require('figures');
54
const convertSourceMap = require('convert-source-map');
6-
const colors = require('./colors');
75

86
function validate(conf) {
97
if (conf === undefined || conf === null) {
@@ -14,9 +12,9 @@ function validate(conf) {
1412
const isValidShortcut = conf === 'default' || conf === 'inherit';
1513

1614
if (!conf || (typeof conf === 'string' && !isValidShortcut)) {
17-
let message = colors.error(figures.cross);
15+
let message = figures.cross;
1816
message += ' Unexpected Babel configuration for AVA. ';
19-
message += 'See ' + chalk.underline('https://github.com/avajs/ava#es2015-support') + ' for allowed values.';
17+
message += 'See https://github.com/avajs/ava#es2015-support for allowed values.';
2018

2119
throw new Error(message);
2220
}

lib/reporters/mini.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ const extractStack = require('../extract-stack');
1414
const codeExcerpt = require('../code-excerpt');
1515
const colors = require('../colors');
1616

17-
chalk.enabled = true;
18-
Object.keys(colors).forEach(key => {
19-
colors[key].enabled = true;
20-
});
21-
2217
// TODO(@jamestalamge): This should be fixed in log-update and ansi-escapes once we are confident it's a good solution.
2318
const CSI = '\u001b[';
2419
const ERASE_LINE = CSI + '2K';

test/cli.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ const cliPath = path.join(__dirname, '../cli.js');
1717

1818
// For some reason chalk is disabled by default
1919
chalk.enabled = true;
20-
const colors = require('../lib/colors');
2120

2221
function execCli(args, opts, cb) {
2322
let dirname;
@@ -75,8 +74,8 @@ test('disallow invalid babel config shortcuts', t => {
7574
t.ok(err);
7675

7776
let expectedOutput = '\n ';
78-
expectedOutput += colors.error(figures.cross) + ' Unexpected Babel configuration for AVA.';
79-
expectedOutput += ' See ' + chalk.underline('https://github.com/avajs/ava#es2015-support') + ' for allowed values.';
77+
expectedOutput += figures.cross + ' Unexpected Babel configuration for AVA.';
78+
expectedOutput += ' See https://github.com/avajs/ava#es2015-support for allowed values.';
8079
expectedOutput += '\n';
8180

8281
t.is(stderr, expectedOutput);

0 commit comments

Comments
 (0)