Skip to content

Commit

Permalink
chore: send warning regarding invalid template to stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgeorge007 committed May 3, 2021
1 parent 60abcd4 commit 601ee07
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion packages/generators/src/addon-generator.ts
@@ -1,3 +1,4 @@
import { yellow } from 'colorette';
import fs from 'fs';
import path from 'path';
import Generator from 'yeoman-generator';
Expand Down Expand Up @@ -57,7 +58,7 @@ const addonGenerator = (

public async prompting(): Promise<void> {
if (!this.supportedTemplates.includes(this.template)) {
this.utils.logger.warn(`${this.template} is not a valid template, please select one from below`);
this.utils.logger.log(`${yellow(`${this.template} is not a valid template, please select one from below`)}`);

const { selectedTemplate } = await List(
this,
Expand Down
4 changes: 2 additions & 2 deletions test/loader/loader.test.js
Expand Up @@ -147,8 +147,8 @@ describe('loader command', () => {

it('should prompt on supplying an invalid template', async () => {
const assetsPath = await uniqueDirectoryForTest();
const { stderr } = await runPromptWithAnswers(assetsPath, ['loader', '--template=unknown']);
const { stdout } = await runPromptWithAnswers(assetsPath, ['loader', '--template=unknown']);

expect(stderr).toContain('unknown is not a valid template');
expect(stdout).toContain('unknown is not a valid template');
});
});
4 changes: 2 additions & 2 deletions test/plugin/plugin.test.js
Expand Up @@ -136,8 +136,8 @@ describe('plugin command', () => {

it('should prompt on supplying an invalid template', async () => {
const assetsPath = await uniqueDirectoryForTest();
const { stderr } = await runPromptWithAnswers(assetsPath, ['plugin', '--template=unknown']);
const { stdout } = await runPromptWithAnswers(assetsPath, ['plugin', '--template=unknown']);

expect(stderr).toContain('unknown is not a valid template');
expect(stdout).toContain('unknown is not a valid template');
});
});

0 comments on commit 601ee07

Please sign in to comment.