Skip to content

Commit

Permalink
fix: generated plugin template (#1717)
Browse files Browse the repository at this point in the history
* fix: generated plugin template

* tests: add check if generated plugin works correctly

* fix: config path

Co-authored-by: Anshuman Verma <anshu.av97@gmail.com>
  • Loading branch information
snitin315 and anshumanv authored Aug 1, 2020
1 parent d315443 commit 1249e1e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/generate-plugin/templates/src/_index.js.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ class <%= name %> {
console.log('Hello World!');
});
}
}

module.exports = <%= name %>;
6 changes: 5 additions & 1 deletion test/plugin/plugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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!');
});
});

0 comments on commit 1249e1e

Please sign in to comment.