Skip to content

Commit 70724b1

Browse files
authored
fix(test): handle pretty formatting (#377)
- integration tests and `pretty` default change got merged simultaneously, so the tests need to be updated to handle the new `pretty` default - the coloration of the errors is quite different when using `pretty` - so instead of re-implementing TS's colors in the tests, just test a portion that is the same color: the error text - also TS doesn't specify semantic vs. syntax, that's something `print-diagnostics` does - this test is more resilient to change as well I suppose since no error codes or colors
1 parent 61d78bd commit 70724b1

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

__tests__/integration/errors.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { jest, afterAll, test, expect } from "@jest/globals";
22
import * as path from "path";
33
import { normalizePath as normalize } from "@rollup/pluginutils";
44
import * as fs from "fs-extra";
5-
import { red } from "colors/safe";
65

76
import { RPT2Options } from "../../src/index";
87
import * as helpers from "./helpers";
@@ -39,7 +38,7 @@ test("integration - tsconfig errors", async () => {
3938
});
4039

4140
test("integration - semantic error", async () => {
42-
expect(genBundle("semantic.ts")).rejects.toThrow(`semantic error TS2322: ${red("Type 'string' is not assignable to type 'number'.")}`);
41+
expect(genBundle("semantic.ts")).rejects.toThrow("Type 'string' is not assignable to type 'number'.");
4342
});
4443

4544
test("integration - semantic error - abortOnError: false / check: false", async () => {
@@ -56,7 +55,7 @@ test("integration - semantic error - abortOnError: false / check: false", async
5655
});
5756

5857
test("integration - syntax error", () => {
59-
expect(genBundle("syntax.ts")).rejects.toThrow(`syntax error TS1005: ${red("';' expected.")}`);
58+
expect(genBundle("syntax.ts")).rejects.toThrow("';' expected.");
6059
});
6160

6261
test("integration - syntax error - abortOnError: false / check: false", () => {

0 commit comments

Comments
 (0)