mirror of
https://github.com/swc-project/swc.git
synced 2024-12-01 01:13:56 +03:00
3a372ad29a
The commit will help - Better testing - Preventing regression like #785. - **Implementing spack** (It requires access to neon api because of the plugin system)
23 lines
605 B
JavaScript
23 lines
605 B
JavaScript
const swc = require("../../");
|
|
|
|
it("should handle script", () => {
|
|
const script = swc.transformSync(`foo;`, { isModule: false });
|
|
expect(script.code.trim()).toBe(`foo;`);
|
|
});
|
|
|
|
it("should parse as script if required", () => {
|
|
const script = swc.parseSync(`foo;`, { isModule: false });
|
|
expect(script.type).toBe("Script");
|
|
|
|
const out = swc.printSync(script);
|
|
expect(out.code.trim()).toBe(`foo;`);
|
|
});
|
|
|
|
it("should parse as module if required", () => {
|
|
const m = swc.parseSync(`foo;`);
|
|
expect(m.type).toBe("Module");
|
|
|
|
const out = swc.printSync(m);
|
|
expect(out.code.trim()).toBe(`foo;`);
|
|
});
|