test(unit): import ESM plugin with named exports

This commit is contained in:
Gregor Martynus 2023-01-14 13:58:42 -08:00
parent f6c978cd9e
commit 86e8f013a7

View File

@ -203,6 +203,12 @@ test("loadPlugin", async (t) => {
await loadPlugin({ cwd }, "./plugin-noop.cjs", { "./plugin-noop.cjs": "./test/fixtures" }),
"From a shareable config context"
);
const { ...namedExports } = await import("../fixtures/plugin-esm-named-exports.js");
const plugin = await loadPlugin({ cwd }, "./plugin-esm-named-exports.js", {
"./plugin-esm-named-exports.js": "./test/fixtures",
});
t.deepEqual(namedExports, plugin, "ESM with named exports");
t.is(func, await loadPlugin({ cwd }, func, {}), "Defined as a function");
});