Skip to content

Commit 5f21d4f

Browse files
committed
test: add non-plugin object to multiple-export.js to test proper PluginLoader behaviour
1 parent 9933950 commit 5f21d4f

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

test/fixtures/test-package/multiple-export.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,9 @@ module.exports = {
99
console.log('PullActionPlugin: ', action);
1010
return action;
1111
}),
12+
baz: {
13+
exec: async (req, action) => {
14+
console.log('not a real plugin object');
15+
},
16+
},
1217
};

test/plugin/plugin.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ describe('loading plugins from packages', function () {
3030
it('should load multiple plugins from a module that match the plugin class (module.exports = { pluginFoo, pluginBar })', async function () {
3131
const loader = new PluginLoader([join(testPackagePath, 'multiple-export.js')]);
3232
await loader.load();
33+
34+
// Should load the foo and bar plugins, but not the baz object which isn't a plugin
3335
expect(loader.pushPlugins.length).to.equal(1);
3436
expect(loader.pullPlugins.length).to.equal(1);
3537
expect(loader.pushPlugins.every((p) => isCompatiblePlugin(p))).to.be.true;
@@ -62,6 +64,8 @@ describe('loading plugins from packages', function () {
6264
it('should load multiple plugins from a module that match the plugin class (exports default { pluginFoo, pluginBar })', async function () {
6365
const loader = new PluginLoader([join(testPackagePath, 'esm-multiple-export.js')]);
6466
await loader.load();
67+
68+
// Should load the foo and bar plugins, but not the baz object which isn't a plugin
6569
expect(loader.pushPlugins.length).to.equal(1);
6670
expect(loader.pullPlugins.length).to.equal(1);
6771
expect(loader.pushPlugins.every((p) => isCompatiblePlugin(p))).to.be.true;

0 commit comments

Comments
 (0)