From 39d42ecfd4d96553caa5bd63fb1048384e3670d3 Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Fri, 11 Jun 2021 23:57:06 +0530 Subject: [PATCH 1/2] fix(create-app): improve prompt message --- packages/create-app/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, From 89ef60a6caf0e6b1b9baeaf7efa95e435c5b7e3e Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Sat, 12 Jun 2021 00:03:23 +0530 Subject: [PATCH 2/2] test: update test suite --- packages/create-app/__tests__/cli.spec.ts | 5 +++++ 1 file changed, 5 insertions(+) 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(