diff --git a/packages/create-app/__tests__/cli.spec.ts b/packages/create-app/__tests__/cli.spec.ts index 465b8d737bd8c7..307ce36a5a2b35 100644 --- a/packages/create-app/__tests__/cli.spec.ts +++ b/packages/create-app/__tests__/cli.spec.ts @@ -44,6 +44,11 @@ test('prompts for the framework if none supplied', () => { expect(stdout).toContain('Select a framework:') }) +test('prompts for the framework on not supplying a value for --template', () => { + const { stdout } = run([projectName, '--template']) + expect(stdout).toContain('Select a framework:') +}) + test('prompts for the framework on supplying an invalid template', () => { const { stdout } = run([projectName, '--template', 'unknown']) expect(stdout).toContain( diff --git a/packages/create-app/index.js b/packages/create-app/index.js index 40546aa66e1bbb..5e2b0e75b0296f 100755 --- a/packages/create-app/index.js +++ b/packages/create-app/index.js @@ -175,7 +175,7 @@ async function init() { type: template && TEMPLATES.includes(template) ? null : 'select', name: 'framework', message: - template && !TEMPLATES.includes(template) + typeof template === 'string' && !TEMPLATES.includes(template) ? `"${template}" isn't a valid template. Please choose from below: ` : 'Select a framework:', initial: 0,