diff --git a/packages/generate-plugin/templates/src/_index.js.tpl b/packages/generate-plugin/templates/src/_index.js.tpl index fb6c348464b..2513c3e70c2 100644 --- a/packages/generate-plugin/templates/src/_index.js.tpl +++ b/packages/generate-plugin/templates/src/_index.js.tpl @@ -11,5 +11,6 @@ class <%= name %> { console.log('Hello World!'); }); } +} module.exports = <%= name %>; diff --git a/test/plugin/plugin.test.js b/test/plugin/plugin.test.js index 86931081d92..e85e09b9e38 100644 --- a/test/plugin/plugin.test.js +++ b/test/plugin/plugin.test.js @@ -24,7 +24,7 @@ describe('plugin command', () => { }); it('should scaffold plugin template with a given name', async () => { - const { stdout } = await runPromptWithAnswers(__dirname, ['plugin'], [`${pluginName}${ENTER}`]); + let { stdout } = await runPromptWithAnswers(__dirname, ['plugin'], [`${pluginName}${ENTER}`]); expect(stdout).toContain(firstPrompt); @@ -42,5 +42,9 @@ describe('plugin command', () => { files.forEach((file) => { expect(existsSync(join(__dirname, `${pluginName}/${file}`))).toBeTruthy(); }); + + //check if the the generated plugin works successfully + stdout = run(__dirname, ['--config', './test-plugin/examples/simple/webpack.config.js'], false).stdout; + expect(stdout).toContain('Hello World!'); }); });