diff --git a/__e2e__/default.test.ts b/__e2e__/default.test.ts index 1ac3b7727..48676d67e 100644 --- a/__e2e__/default.test.ts +++ b/__e2e__/default.test.ts @@ -14,3 +14,8 @@ test('shows up help information without passing in any args', () => { const {stderr} = runCLI(DIR); expect(stderr).toMatchSnapshot(); }); + +test('does not pass --platform-name by default', () => { + const {stderr} = runCLI(DIR); + expect(stderr).not.toContain("unknown option '--platform-name'"); +}); diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index 2f973f307..323653bf9 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -213,8 +213,8 @@ async function setupAndRun(platformName?: string) { const argv = [...process.argv]; - // If out of tree platform specifices custom platform name by passing it to , we need to pass it to argv array. - if (platformName) { + // If out of tree platform specifices custom platform name, we need to pass it to argv array for the init command. + if (process.argv.includes('init') && platformName) { argv.push('--platform-name', platformName); }