2021-08-13 13:03:04 +03:00
|
|
|
import { dirname } from 'path';
|
|
|
|
import { fileURLToPath } from 'url';
|
|
|
|
import * as swc from '../..';
|
|
|
|
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
2020-05-22 14:36:39 +03:00
|
|
|
|
|
|
|
it("should work", () => {
|
|
|
|
expect(() => {
|
|
|
|
swc.transformFileSync(__dirname + "/../tests/error/simple.js");
|
|
|
|
}).toThrow("jsc");
|
|
|
|
});
|
2021-04-08 15:55:02 +03:00
|
|
|
|
2021-08-13 13:03:04 +03:00
|
|
|
it("should report good error", () => {
|
|
|
|
expect(() => {
|
|
|
|
swc.transformFileSync(__dirname + "/../tests/error/simple.js");
|
2023-08-14 19:33:17 +03:00
|
|
|
}).toThrow("failed to deserialize .swcrc (json) file");
|
2021-08-13 13:03:04 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
it("should report good error (handler)", () => {
|
|
|
|
expect(() => {
|
|
|
|
swc.transformFileSync(__dirname + "/../tests/legacy/octal.js");
|
|
|
|
}).toThrow("console.log(00017)");
|
|
|
|
});
|