From 4dc7466f501619eb6c2739fb76d2a815e4bfa5ee Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Fri, 31 Jul 2020 17:26:31 +0530 Subject: [PATCH 1/3] fix: generated plugin template --- packages/generate-plugin/templates/src/_index.js.tpl | 1 + 1 file changed, 1 insertion(+) 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 %>; From 96a5ca0b286a615928e17a7646871d7370881b55 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Fri, 31 Jul 2020 18:12:08 +0530 Subject: [PATCH 2/3] tests: add check if generated plugin works correctly --- test/plugin/plugin.test.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/plugin/plugin.test.js b/test/plugin/plugin.test.js index 86931081d92..1e54ee2e651 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', './examples/simple/webpack.config.js'], false).stdout; + expect(stdout).toContain('Hello World!'); }); }); From bdac5f4615735de417bf8158ff82907f3b14a2ab Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Fri, 31 Jul 2020 18:15:58 +0530 Subject: [PATCH 3/3] fix: config path --- test/plugin/plugin.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/plugin/plugin.test.js b/test/plugin/plugin.test.js index 1e54ee2e651..e85e09b9e38 100644 --- a/test/plugin/plugin.test.js +++ b/test/plugin/plugin.test.js @@ -44,7 +44,7 @@ describe('plugin command', () => { }); //check if the the generated plugin works successfully - stdout = run(__dirname, ['--config', './examples/simple/webpack.config.js'], false).stdout; + stdout = run(__dirname, ['--config', './test-plugin/examples/simple/webpack.config.js'], false).stdout; expect(stdout).toContain('Hello World!'); }); });