Skip to content

Commit abc6b53

Browse files
ntwbnot-an-aardvark
authored andcommitted
Upgrade: chalk to 2.x release (#9115)
1 parent 6f3b73b commit abc6b53

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

test.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const sinon = require("sinon");
1414
const proxyquire = require("proxyquire");
1515
const chalk = require("chalk");
1616
const path = require("path");
17+
const stripAnsi = require("strip-ansi");
1718

1819
// Chalk protects its methods so we need to inherit from it for Sinon to work.
1920
const chalkStub = Object.create(chalk, {
@@ -86,7 +87,7 @@ describe("formatter:codeframe", () => {
8687
it("should return a string in the correct format for warnings", () => {
8788
const result = formatter(code);
8889

89-
assert.equal(chalk.stripColor(result), [
90+
assert.equal(stripAnsi(result), [
9091
`warning: Unexpected foo (foo) at ${path.join("lib", "foo.js")}:1:5:`,
9192
"> 1 | var foo = 1;",
9293
" | ^",
@@ -115,7 +116,7 @@ describe("formatter:codeframe", () => {
115116
it("should return a string in the correct format", () => {
116117
const result = formatter(code);
117118

118-
assert.equal(chalk.stripColor(result), [
119+
assert.equal(stripAnsi(result), [
119120
`warning: Unexpected foo (foo) at ${path.join("lib", "foo.js")}:1:5:`,
120121
"> 1 | var foo = 1;",
121122
" | ^",
@@ -147,7 +148,7 @@ describe("formatter:codeframe", () => {
147148
it("should return a string in the correct format for errors", () => {
148149
const result = formatter(code);
149150

150-
assert.equal(chalk.stripColor(result), [
151+
assert.equal(stripAnsi(result), [
151152
`error: Unexpected foo (foo) at ${path.join("lib", "foo.js")}:1:5:`,
152153
"> 1 | var foo = 1;",
153154
" | ^",
@@ -193,7 +194,7 @@ describe("formatter:codeframe", () => {
193194
it("should return a string with multiple entries", () => {
194195
const result = formatter(code);
195196

196-
assert.equal(chalk.stripColor(result), [
197+
assert.equal(stripAnsi(result), [
197198
"error: Missing semicolon (semi) at foo.js:1:14:",
198199
"> 1 | const foo = 1",
199200
" | ^",
@@ -241,7 +242,7 @@ describe("formatter:codeframe", () => {
241242
it("should return a string with code preview pointing to the correct location after fixes", () => {
242243
const result = formatter(code);
243244

244-
assert.equal(chalk.stripColor(result), [
245+
assert.equal(stripAnsi(result), [
245246
"error: 'foo' is assigned a value but never used (no-unused-vars) at foo.js:4:11:",
246247
" 2 | ",
247248
" 3 | // a comment",
@@ -286,7 +287,7 @@ describe("formatter:codeframe", () => {
286287
it("should return a string with multiple entries", () => {
287288
const result = formatter(code);
288289

289-
assert.equal(chalk.stripColor(result), [
290+
assert.equal(stripAnsi(result), [
290291
"error: Missing semicolon (semi) at foo.js:1:14:",
291292
"> 1 | const foo = 1",
292293
" | ^",
@@ -322,7 +323,7 @@ describe("formatter:codeframe", () => {
322323
it("should return a string in the correct format", () => {
323324
const result = formatter(code);
324325

325-
assert.equal(chalk.stripColor(result), [
326+
assert.equal(stripAnsi(result), [
326327
"error: Parsing error: Unexpected token { at foo.js:1:2:",
327328
"> 1 | e{}",
328329
" | ^",
@@ -347,7 +348,7 @@ describe("formatter:codeframe", () => {
347348
it("should return a string without code preview (codeframe)", () => {
348349
const result = formatter(code);
349350

350-
assert.equal(chalk.stripColor(result), "error: Couldn't find foo.js at foo.js\n\n\n1 error found.");
351+
assert.equal(stripAnsi(result), "error: Couldn't find foo.js at foo.js\n\n\n1 error found.");
351352
});
352353
});
353354

@@ -367,13 +368,13 @@ describe("formatter:codeframe", () => {
367368
it("should return a string without code preview (codeframe)", () => {
368369
const result = formatter(code);
369370

370-
assert.equal(chalk.stripColor(result), "error: Unexpected foo (foo) at foo.js\n\n\n1 error found.");
371+
assert.equal(stripAnsi(result), "error: Unexpected foo (foo) at foo.js\n\n\n1 error found.");
371372
});
372373

373374
it("should output filepath but without 'line:column' appended", () => {
374375
const result = formatter(code);
375376

376-
assert.equal(chalk.stripColor(result), "error: Unexpected foo (foo) at foo.js\n\n\n1 error found.");
377+
assert.equal(stripAnsi(result), "error: Unexpected foo (foo) at foo.js\n\n\n1 error found.");
377378
});
378379
});
379380

0 commit comments

Comments
 (0)