swc/node-swc/__tests__/v2_plugin.mjs
Donny/강동윤 91ef3cc16e
feat(plugin): Enable plugin support under experimental flag (#2894)
swc_plugin_runner:
 - Add plugin resolver.
 - Implement cache for resolver.
 - Add some integration tests.

swc:
 - Add a cargo feature named `plugin`.
 - Add an experimental option for plugins.

node:
 - Enable `plugin`.
 - Add some integration tests.
2021-11-28 17:02:14 +09:00

27 lines
708 B
JavaScript

import swc from '../..';
// it("should resolve", async () => {
// const { code } = await swc.transform(`console.log("Should be removed")`, {
// jsc: {
// experimental: {
// plugins: [
// ['internal-test', {}]
// ]
// }
// }
// });
// expect(code).toMatch(``)
// })
it("should error if it's not resolved", async () => {
await expect(swc.transform(`console.log("Should be removed")`, {
jsc: {
experimental: {
plugins: [
['unknown', {}]
]
}
}
})).rejects.toThrow("failed to resolve plugin `unknown`");
})