Skip to content

Commit

Permalink
test(unit): import ESM plugin with named exports
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m authored and travi committed Jan 25, 2023
1 parent 4079a4c commit 11312fd
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/plugins/utils.test.js
Expand Up @@ -199,7 +199,18 @@ test('loadPlugin', async (t) => {
await loadPlugin({cwd}, './plugin-noop.cjs', {'./plugin-noop.cjs': './test/fixtures'}),
'From a shareable config context'
);
t.is(func, await loadPlugin({cwd}, func, {}), 'Defined as a function');
t.is(
(await import("../fixtures/plugin-noop.cjs")).default,
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");
});

test('parseConfig', (t) => {
Expand Down

0 comments on commit 11312fd

Please sign in to comment.