swc/node-swc/__tests__/error_test.mjs

23 lines
642 B
JavaScript
Raw Normal View History

import { dirname } from 'path';
import { fileURLToPath } from 'url';
import * as swc from '../..';
const __dirname = dirname(fileURLToPath(import.meta.url));
it("should work", () => {
expect(() => {
swc.transformFileSync(__dirname + "/../tests/error/simple.js");
}).toThrow("jsc");
});
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");
});
it("should report good error (handler)", () => {
expect(() => {
swc.transformFileSync(__dirname + "/../tests/legacy/octal.js");
}).toThrow("console.log(00017)");
});