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-01-11 11:40:40 +03:00
|
|
|
}).toThrow("failed to read swcrc 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)");
|
|
|
|
});
|