Skip to content
This repository was archived by the owner on Jul 27, 2021. It is now read-only.

Commit 4c5bf97

Browse files
committed
add strip-ansi to cover for removed stripColor function in chalk
1 parent 3dba5db commit 4c5bf97

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"dependencies": {
4545
"chalk": "^2.4.2",
4646
"error-stack-parser": "^2.0.0",
47-
"string-width": "^2.0.0"
47+
"string-width": "^2.0.0",
48+
"strip-ansi": "^3"
4849
}
4950
}

src/output.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const colors = require('./utils/colors');
44
const chalk = require('chalk');
55
const stringWidth = require('string-width');
66
const readline = require('readline');
7+
const stripAnsi = require('strip-ansi');
78

89
class Debugger {
910

@@ -98,7 +99,7 @@ class Debugger {
9899

99100
captureConsole (args, method) {
100101
if (this.capturing) {
101-
this.capturedMessages.push(chalk.stripColor(args.join(' ')).trim());
102+
this.capturedMessages.push(stripAnsi(args.join(' ')).trim());
102103
} else {
103104
method.apply(console, args);
104105
}

test/unit/formatters/defaultError.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
const defaultError = require('../../../src/formatters/defaultError');
22
const expect = require('expect');
3-
const chalk = require('chalk');
3+
const stripAnsi = require('strip-ansi');
44

5-
const noColor = (arr) => arr.map(chalk.stripColor);
5+
const noColor = (arr) => arr.map(stripAnsi);
66
const error = { message: 'Error message', file: './src/index.js' };
77

88
it('Formats errors with no type', () => {

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3656,7 +3656,7 @@ stringstream@~0.0.4:
36563656
resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878"
36573657
integrity sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=
36583658

3659-
strip-ansi@^3.0.0, strip-ansi@^3.0.1:
3659+
strip-ansi@^3, strip-ansi@^3.0.0, strip-ansi@^3.0.1:
36603660
version "3.0.1"
36613661
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf"
36623662
integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=

0 commit comments

Comments
 (0)