mirror of
https://github.com/ezolenko/rollup-plugin-typescript2.git
synced 2025-12-08 19:06:16 +00:00
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
This commit is contained in:
parent
61d78bd2f3
commit
70724b1af5
@ -2,7 +2,6 @@ import { jest, afterAll, test, expect } from "@jest/globals";
|
||||
import * as path from "path";
|
||||
import { normalizePath as normalize } from "@rollup/pluginutils";
|
||||
import * as fs from "fs-extra";
|
||||
import { red } from "colors/safe";
|
||||
|
||||
import { RPT2Options } from "../../src/index";
|
||||
import * as helpers from "./helpers";
|
||||
@ -39,7 +38,7 @@ test("integration - tsconfig errors", async () => {
|
||||
});
|
||||
|
||||
test("integration - semantic error", async () => {
|
||||
expect(genBundle("semantic.ts")).rejects.toThrow(`semantic error TS2322: ${red("Type 'string' is not assignable to type 'number'.")}`);
|
||||
expect(genBundle("semantic.ts")).rejects.toThrow("Type 'string' is not assignable to type 'number'.");
|
||||
});
|
||||
|
||||
test("integration - semantic error - abortOnError: false / check: false", async () => {
|
||||
@ -56,7 +55,7 @@ test("integration - semantic error - abortOnError: false / check: false", async
|
||||
});
|
||||
|
||||
test("integration - syntax error", () => {
|
||||
expect(genBundle("syntax.ts")).rejects.toThrow(`syntax error TS1005: ${red("';' expected.")}`);
|
||||
expect(genBundle("syntax.ts")).rejects.toThrow("';' expected.");
|
||||
});
|
||||
|
||||
test("integration - syntax error - abortOnError: false / check: false", () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user