Skip to content

Commit 237a79f

Browse files
committed
remove color
1 parent a0dd7ce commit 237a79f

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

tests/ts/test/__snapshots__/assertResult.test.ts.snap

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
exports[`print 1`] = `
44
"
5+
test case: 27/28 (success/total)
6+
7+
Error Message:
8+
A:
9+
tests/as/comparison.test.ts:10:20 value: 100 expect: = 200
10+
log message 1
11+
log message 2
12+
log message 3"
13+
`;
14+
15+
exports[`print 2`] = `
16+
"
517
test case: 27/28 (success/total)
618
719
Error Message: 

tests/ts/test/assertResult.test.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { join } from "node:path";
22
import { fileURLToPath, URL } from "node:url";
33
import { FailedInfoMap, IAssertResult } from "../../../src/interface.js";
44
import { AssertResult } from "../../../src/assertResult.js";
5+
import chalk from "chalk";
56

67
const __dirname = fileURLToPath(new URL(".", import.meta.url));
78

@@ -71,8 +72,16 @@ test("print", async () => {
7172
const expectInfoFIlePath = join(__dirname, "..", "fixture", "assertResultTest.expectInfo.json");
7273
await assertResult.merge(testcaseA, expectInfoFIlePath);
7374

74-
const outputs: string[] = [];
75-
assertResult.print((msg) => outputs.push(msg));
76-
77-
expect(outputs.join("\n")).toMatchSnapshot();
75+
{
76+
const outputs: string[] = [];
77+
chalk.level = 0; // disable color
78+
assertResult.print((msg) => outputs.push(msg));
79+
expect(outputs.join("\n")).toMatchSnapshot();
80+
}
81+
{
82+
const outputs: string[] = [];
83+
chalk.level = 1; // force enable color
84+
assertResult.print((msg) => outputs.push(msg));
85+
expect(outputs.join("\n")).toMatchSnapshot();
86+
}
7887
});

0 commit comments

Comments
 (0)