From b52152f1622b756cc20ae9067652d7a3c36b1d23 Mon Sep 17 00:00:00 2001 From: Roshane Pascual Date: Mon, 28 Aug 2023 14:18:45 -0700 Subject: [PATCH 1/9] fix: add better error messaging for subsequent init with default env --- .../init-steps/s0-analyzeProject.test.ts | 34 ++++++++++++++++++- .../src/init-steps/s0-analyzeProject.ts | 11 +++--- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/packages/amplify-cli/src/__tests__/init-steps/s0-analyzeProject.test.ts b/packages/amplify-cli/src/__tests__/init-steps/s0-analyzeProject.test.ts index 8077a908a1b..1370d446635 100644 --- a/packages/amplify-cli/src/__tests__/init-steps/s0-analyzeProject.test.ts +++ b/packages/amplify-cli/src/__tests__/init-steps/s0-analyzeProject.test.ts @@ -1,8 +1,9 @@ -import { $TSContext, stateManager } from '@aws-amplify/amplify-cli-core'; +import { $TSContext, AmplifyError, stateManager } from '@aws-amplify/amplify-cli-core'; import { analyzeProject } from '../../init-steps/s0-analyzeProject'; import { constructMockPluginPlatform } from '../extensions/amplify-helpers/mock-plugin-platform'; import { CLIInput as CommandLineInput } from '../../domain/command-input'; import { constructContext } from '../../context-manager'; +import * as fs from 'fs-extra'; jest.spyOn(stateManager, 'getLocalAWSInfo').mockReturnValue({ envA: 'test', envB: 'test' }); jest.spyOn(stateManager, 'getLocalEnvInfo').mockReturnValue({ defaultEditor: 'Visual Studio Code' }); @@ -75,4 +76,35 @@ describe('analyzeProject', () => { await analyzeProject(mockContext); expect(mockContext.exeInfo.isNewEnv).toBe(true); }); + + it('throws helpful error message when running subsequent init -y commands', async () => { + const emitErrorMock = jest.fn(); + + mockContext.amplify = { + confirmPrompt: jest.fn(), + getAllEnvs: jest.fn().mockReturnValue(['dev']), + pathManager: { + getProjectConfigFilePath: jest.fn().mockReturnValue('mockDirPath'), + }, + }; + mockContext.exeInfo = { + isNewProject: false, + }; + mockContext.exeInfo.inputParams = { + amplify: {}, + yes: true, + }; + mockContext.usageData = { + emitError: emitErrorMock, + }; + + jest.spyOn(fs, 'existsSync').mockReturnValue(true); + + const amplifyError = new AmplifyError('ProjectInitError', { + message: `Amplify project is already initialized with environment name: dev`, + resolution: `To create a new environment run \`amplify add env\``, + }); + + await expect(analyzeProject(mockContext)).rejects.toThrow(amplifyError); + }); }); diff --git a/packages/amplify-cli/src/init-steps/s0-analyzeProject.ts b/packages/amplify-cli/src/init-steps/s0-analyzeProject.ts index b93d4f59caa..43bf7974838 100644 --- a/packages/amplify-cli/src/init-steps/s0-analyzeProject.ts +++ b/packages/amplify-cli/src/init-steps/s0-analyzeProject.ts @@ -220,8 +220,11 @@ const getDefaultEnv = (context: $TSContext): string | undefined => { resolution: INVALID_ENV_NAME_MSG, }); } - - if (isNewProject(context) || !context.amplify.getAllEnvs().includes(defaultEnv)) { + if ( + isNewProject(context) || + !context.amplify.getAllEnvs().includes(defaultEnv) || + (context.exeInfo.inputParams && context.exeInfo.inputParams.yes) + ) { return defaultEnv; } return undefined; @@ -241,8 +244,8 @@ const getEnvName = async (context: $TSContext): Promise => { }); } else if (context.exeInfo.inputParams && context.exeInfo.inputParams.yes) { throw new AmplifyError('ProjectInitError', { - message: `Invalid environment name: ${context.exeInfo.inputParams.amplify.envName}`, - resolution: INVALID_ENV_NAME_MSG, + message: `Amplify project is already initialized with environment name: ${getDefaultEnv(context)}`, + resolution: `To create a new environment run \`amplify add env\``, }); } From 7c23cd751be336837d1d8140cc92c376b869abd8 Mon Sep 17 00:00:00 2001 From: Roshane Pascual Date: Wed, 6 Sep 2023 15:13:13 -0700 Subject: [PATCH 2/9] Revert "fix: add better error messaging for subsequent init with default env" This reverts commit b52152f1622b756cc20ae9067652d7a3c36b1d23. --- .../init-steps/s0-analyzeProject.test.ts | 34 +------------------ .../src/init-steps/s0-analyzeProject.ts | 11 +++--- 2 files changed, 5 insertions(+), 40 deletions(-) diff --git a/packages/amplify-cli/src/__tests__/init-steps/s0-analyzeProject.test.ts b/packages/amplify-cli/src/__tests__/init-steps/s0-analyzeProject.test.ts index 1370d446635..8077a908a1b 100644 --- a/packages/amplify-cli/src/__tests__/init-steps/s0-analyzeProject.test.ts +++ b/packages/amplify-cli/src/__tests__/init-steps/s0-analyzeProject.test.ts @@ -1,9 +1,8 @@ -import { $TSContext, AmplifyError, stateManager } from '@aws-amplify/amplify-cli-core'; +import { $TSContext, stateManager } from '@aws-amplify/amplify-cli-core'; import { analyzeProject } from '../../init-steps/s0-analyzeProject'; import { constructMockPluginPlatform } from '../extensions/amplify-helpers/mock-plugin-platform'; import { CLIInput as CommandLineInput } from '../../domain/command-input'; import { constructContext } from '../../context-manager'; -import * as fs from 'fs-extra'; jest.spyOn(stateManager, 'getLocalAWSInfo').mockReturnValue({ envA: 'test', envB: 'test' }); jest.spyOn(stateManager, 'getLocalEnvInfo').mockReturnValue({ defaultEditor: 'Visual Studio Code' }); @@ -76,35 +75,4 @@ describe('analyzeProject', () => { await analyzeProject(mockContext); expect(mockContext.exeInfo.isNewEnv).toBe(true); }); - - it('throws helpful error message when running subsequent init -y commands', async () => { - const emitErrorMock = jest.fn(); - - mockContext.amplify = { - confirmPrompt: jest.fn(), - getAllEnvs: jest.fn().mockReturnValue(['dev']), - pathManager: { - getProjectConfigFilePath: jest.fn().mockReturnValue('mockDirPath'), - }, - }; - mockContext.exeInfo = { - isNewProject: false, - }; - mockContext.exeInfo.inputParams = { - amplify: {}, - yes: true, - }; - mockContext.usageData = { - emitError: emitErrorMock, - }; - - jest.spyOn(fs, 'existsSync').mockReturnValue(true); - - const amplifyError = new AmplifyError('ProjectInitError', { - message: `Amplify project is already initialized with environment name: dev`, - resolution: `To create a new environment run \`amplify add env\``, - }); - - await expect(analyzeProject(mockContext)).rejects.toThrow(amplifyError); - }); }); diff --git a/packages/amplify-cli/src/init-steps/s0-analyzeProject.ts b/packages/amplify-cli/src/init-steps/s0-analyzeProject.ts index 43bf7974838..b93d4f59caa 100644 --- a/packages/amplify-cli/src/init-steps/s0-analyzeProject.ts +++ b/packages/amplify-cli/src/init-steps/s0-analyzeProject.ts @@ -220,11 +220,8 @@ const getDefaultEnv = (context: $TSContext): string | undefined => { resolution: INVALID_ENV_NAME_MSG, }); } - if ( - isNewProject(context) || - !context.amplify.getAllEnvs().includes(defaultEnv) || - (context.exeInfo.inputParams && context.exeInfo.inputParams.yes) - ) { + + if (isNewProject(context) || !context.amplify.getAllEnvs().includes(defaultEnv)) { return defaultEnv; } return undefined; @@ -244,8 +241,8 @@ const getEnvName = async (context: $TSContext): Promise => { }); } else if (context.exeInfo.inputParams && context.exeInfo.inputParams.yes) { throw new AmplifyError('ProjectInitError', { - message: `Amplify project is already initialized with environment name: ${getDefaultEnv(context)}`, - resolution: `To create a new environment run \`amplify add env\``, + message: `Invalid environment name: ${context.exeInfo.inputParams.amplify.envName}`, + resolution: INVALID_ENV_NAME_MSG, }); } From 98257a49da36d48e08c22dec6a5bc56d06d90a68 Mon Sep 17 00:00:00 2001 From: Roshane Pascual Date: Thu, 7 Sep 2023 18:15:57 -0700 Subject: [PATCH 3/9] fix: add better error messaging when initializing an already initialized project --- .../init-steps/s0-analyzeProject.test.ts | 25 ++++++++++++++++++- .../src/init-steps/s0-analyzeProject.ts | 9 +++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/packages/amplify-cli/src/__tests__/init-steps/s0-analyzeProject.test.ts b/packages/amplify-cli/src/__tests__/init-steps/s0-analyzeProject.test.ts index 8077a908a1b..11e5c63ecf8 100644 --- a/packages/amplify-cli/src/__tests__/init-steps/s0-analyzeProject.test.ts +++ b/packages/amplify-cli/src/__tests__/init-steps/s0-analyzeProject.test.ts @@ -1,8 +1,9 @@ -import { $TSContext, stateManager } from '@aws-amplify/amplify-cli-core'; +import { $TSContext, AmplifyError, stateManager } from '@aws-amplify/amplify-cli-core'; import { analyzeProject } from '../../init-steps/s0-analyzeProject'; import { constructMockPluginPlatform } from '../extensions/amplify-helpers/mock-plugin-platform'; import { CLIInput as CommandLineInput } from '../../domain/command-input'; import { constructContext } from '../../context-manager'; +import * as fs from 'fs-extra'; jest.spyOn(stateManager, 'getLocalAWSInfo').mockReturnValue({ envA: 'test', envB: 'test' }); jest.spyOn(stateManager, 'getLocalEnvInfo').mockReturnValue({ defaultEditor: 'Visual Studio Code' }); @@ -75,4 +76,26 @@ describe('analyzeProject', () => { await analyzeProject(mockContext); expect(mockContext.exeInfo.isNewEnv).toBe(true); }); + + it('throws helpful error message when running subsequent init -y commands', async () => { + const appID = 'testAppID'; + const currentEnv = 'dev'; + + mockContext.parameters = { + options: { + yes: true, + }, + }; + + jest.spyOn(fs, 'existsSync').mockReturnValue(true); + jest.spyOn(stateManager, 'getAppID').mockReturnValue(appID); + jest.spyOn(stateManager, 'getCurrentEnvName').mockReturnValue(currentEnv); + + const amplifyError = new AmplifyError('ProjectInitError', { + message: `Amplify project ${appID} is already initialized for environment ${currentEnv}`, + resolution: `To create a new environment run \`amplify add env\``, + }); + + await expect(analyzeProject(mockContext)).rejects.toThrow(amplifyError); + }); }); diff --git a/packages/amplify-cli/src/init-steps/s0-analyzeProject.ts b/packages/amplify-cli/src/init-steps/s0-analyzeProject.ts index b93d4f59caa..be29cad18fa 100644 --- a/packages/amplify-cli/src/init-steps/s0-analyzeProject.ts +++ b/packages/amplify-cli/src/init-steps/s0-analyzeProject.ts @@ -105,6 +105,15 @@ export const analyzeProject = async (context: $TSContext): Promise<$TSContext> = await displayAndSetDefaults(context, projectPath, projectName); } + if (!context.exeInfo.isNewProject && context.parameters.options && context.parameters.options.yes) { + throw new AmplifyError('ProjectInitError', { + message: `Amplify project ${stateManager.getAppID()} is already initialized for environment ${stateManager.getCurrentEnvName( + projectPath, + )}`, + resolution: 'To create a new environment run `amplify add env`', + }); + } + const envName = await getEnvName(context); let defaultEditor = getDefaultEditor(); From d7a76965360133f2e3015993290210d9240055a1 Mon Sep 17 00:00:00 2001 From: Roshane Pascual Date: Tue, 12 Sep 2023 14:53:16 -0700 Subject: [PATCH 4/9] chore: add e2e test for init an existing project --- .../src/__tests__/init-special-case.test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/amplify-e2e-tests/src/__tests__/init-special-case.test.ts b/packages/amplify-e2e-tests/src/__tests__/init-special-case.test.ts index 26407dee254..fddf320b1a3 100644 --- a/packages/amplify-e2e-tests/src/__tests__/init-special-case.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/init-special-case.test.ts @@ -4,6 +4,7 @@ import { createNewProjectDir, deleteProject, deleteProjectDir, + getAppId, getBackendAmplifyMeta, getParameters, getProjectMeta, @@ -11,6 +12,7 @@ import { gitCleanFdx, gitCommitAll, gitInit, + initHeadless, initJSProjectWithProfile, updateAuthAddUserGroups, updatedInitNewEnvWithProfile, @@ -72,4 +74,12 @@ describe('amplify init', () => { getParameters(projectRoot, category, authResourceName); }).not.toThrow(); }); + + it('should fail if running amplify init -y on already initialized project', async () => { + const envName = 'devtest'; + const resourceName = 'twoInitDefaultTest'; + await initJSProjectWithProfile(projectRoot, { disableAmplifyAppCreation: false, name: resourceName, envName }); + const appId = getAppId(projectRoot); + await expect(initHeadless(projectRoot, envName, appId)).rejects.toThrowError('Process exited with non zero exit code 1'); + }); }); From 842bf004a12d8fb8fbafb4868b2760b67cd55b7e Mon Sep 17 00:00:00 2001 From: Roshane Pascual Date: Wed, 13 Sep 2023 15:35:08 -0700 Subject: [PATCH 5/9] fix: update condition for already initialized error --- packages/amplify-cli/src/init-steps/s0-analyzeProject.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/amplify-cli/src/init-steps/s0-analyzeProject.ts b/packages/amplify-cli/src/init-steps/s0-analyzeProject.ts index be29cad18fa..e4b9487f4c1 100644 --- a/packages/amplify-cli/src/init-steps/s0-analyzeProject.ts +++ b/packages/amplify-cli/src/init-steps/s0-analyzeProject.ts @@ -99,13 +99,16 @@ export const analyzeProject = async (context: $TSContext): Promise<$TSContext> = } const projectPath = process.cwd(); context.exeInfo.isNewProject = isNewProject(context); + context.exeInfo.forcePush = !!context?.parameters?.options?.forcePush; const projectName = await getProjectName(context); if (context.exeInfo.isNewProject && context.parameters.command !== 'env') { await displayAndSetDefaults(context, projectPath, projectName); } - if (!context.exeInfo.isNewProject && context.parameters.options && context.parameters.options.yes) { + // If forcePush is true, that means running `init -y --forcePush` which is used for the init handler + // this allows the function category to run pre-push checks after project is initialized + if (!context.exeInfo.isNewProject && context.parameters.options && context.parameters.options.yes && !context.exeInfo.forcePush) { throw new AmplifyError('ProjectInitError', { message: `Amplify project ${stateManager.getAppID()} is already initialized for environment ${stateManager.getCurrentEnvName( projectPath, From b57f9ed097a78880531dc8e8d85aa023e72fbe53 Mon Sep 17 00:00:00 2001 From: Roshane Pascual Date: Tue, 19 Sep 2023 16:25:01 -0700 Subject: [PATCH 6/9] fix: update condition again --- packages/amplify-cli/src/init-steps/s0-analyzeProject.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/amplify-cli/src/init-steps/s0-analyzeProject.ts b/packages/amplify-cli/src/init-steps/s0-analyzeProject.ts index e4b9487f4c1..af0ff0015c4 100644 --- a/packages/amplify-cli/src/init-steps/s0-analyzeProject.ts +++ b/packages/amplify-cli/src/init-steps/s0-analyzeProject.ts @@ -106,9 +106,12 @@ export const analyzeProject = async (context: $TSContext): Promise<$TSContext> = await displayAndSetDefaults(context, projectPath, projectName); } - // If forcePush is true, that means running `init -y --forcePush` which is used for the init handler - // this allows the function category to run pre-push checks after project is initialized - if (!context.exeInfo.isNewProject && context.parameters.options && context.parameters.options.yes && !context.exeInfo.forcePush) { + if ( + !context.exeInfo.isNewProject && + context.parameters.options && + context.parameters.options.yes && + !context.exeInfo.inputParams.amplify?.envName + ) { throw new AmplifyError('ProjectInitError', { message: `Amplify project ${stateManager.getAppID()} is already initialized for environment ${stateManager.getCurrentEnvName( projectPath, From 856d50c3b9a0e41573cecb76d6503699a3d3bdf7 Mon Sep 17 00:00:00 2001 From: Roshane Pascual Date: Tue, 19 Sep 2023 18:08:18 -0700 Subject: [PATCH 7/9] test: add function to run init with only yes option --- packages/amplify-e2e-core/src/init/initProjectHelper.ts | 4 ++++ .../src/__tests__/init-special-case.test.ts | 6 ++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/amplify-e2e-core/src/init/initProjectHelper.ts b/packages/amplify-e2e-core/src/init/initProjectHelper.ts index 3d8d7f63093..9dd4f3a9107 100644 --- a/packages/amplify-e2e-core/src/init/initProjectHelper.ts +++ b/packages/amplify-e2e-core/src/init/initProjectHelper.ts @@ -516,3 +516,7 @@ export function amplifyStatus(cwd: string, expectedStatus: string, testingWithLa export function initHeadless(cwd: string, envName: string, appId: string): Promise { return spawn(getCLIPath(), ['init', '--yes', '--envName', envName, '--appId', appId], { cwd, stripColors: true }).runAsync(); } + +export function initNonInteractive(cwd: string): Promise { + return spawn(getCLIPath(), ['init', '--yes'], { cwd, stripColors: true }).runAsync(); +} diff --git a/packages/amplify-e2e-tests/src/__tests__/init-special-case.test.ts b/packages/amplify-e2e-tests/src/__tests__/init-special-case.test.ts index fddf320b1a3..060676f905f 100644 --- a/packages/amplify-e2e-tests/src/__tests__/init-special-case.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/init-special-case.test.ts @@ -4,7 +4,6 @@ import { createNewProjectDir, deleteProject, deleteProjectDir, - getAppId, getBackendAmplifyMeta, getParameters, getProjectMeta, @@ -12,8 +11,8 @@ import { gitCleanFdx, gitCommitAll, gitInit, - initHeadless, initJSProjectWithProfile, + initNonInteractive, updateAuthAddUserGroups, updatedInitNewEnvWithProfile, } from '@aws-amplify/amplify-e2e-core'; @@ -79,7 +78,6 @@ describe('amplify init', () => { const envName = 'devtest'; const resourceName = 'twoInitDefaultTest'; await initJSProjectWithProfile(projectRoot, { disableAmplifyAppCreation: false, name: resourceName, envName }); - const appId = getAppId(projectRoot); - await expect(initHeadless(projectRoot, envName, appId)).rejects.toThrowError('Process exited with non zero exit code 1'); + await expect(initNonInteractive(projectRoot)).rejects.toThrowError('Process exited with non zero exit code 1'); }); }); From 08734a9d2d9dba671ed3cff59b84f4f456c03927 Mon Sep 17 00:00:00 2001 From: Roshane Pascual Date: Wed, 20 Sep 2023 10:38:24 -0700 Subject: [PATCH 8/9] Revert "test: add function to run init with only yes option" This reverts commit 856d50c3b9a0e41573cecb76d6503699a3d3bdf7. --- packages/amplify-e2e-core/src/init/initProjectHelper.ts | 4 ---- .../src/__tests__/init-special-case.test.ts | 6 ++++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/amplify-e2e-core/src/init/initProjectHelper.ts b/packages/amplify-e2e-core/src/init/initProjectHelper.ts index 9dd4f3a9107..3d8d7f63093 100644 --- a/packages/amplify-e2e-core/src/init/initProjectHelper.ts +++ b/packages/amplify-e2e-core/src/init/initProjectHelper.ts @@ -516,7 +516,3 @@ export function amplifyStatus(cwd: string, expectedStatus: string, testingWithLa export function initHeadless(cwd: string, envName: string, appId: string): Promise { return spawn(getCLIPath(), ['init', '--yes', '--envName', envName, '--appId', appId], { cwd, stripColors: true }).runAsync(); } - -export function initNonInteractive(cwd: string): Promise { - return spawn(getCLIPath(), ['init', '--yes'], { cwd, stripColors: true }).runAsync(); -} diff --git a/packages/amplify-e2e-tests/src/__tests__/init-special-case.test.ts b/packages/amplify-e2e-tests/src/__tests__/init-special-case.test.ts index 060676f905f..fddf320b1a3 100644 --- a/packages/amplify-e2e-tests/src/__tests__/init-special-case.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/init-special-case.test.ts @@ -4,6 +4,7 @@ import { createNewProjectDir, deleteProject, deleteProjectDir, + getAppId, getBackendAmplifyMeta, getParameters, getProjectMeta, @@ -11,8 +12,8 @@ import { gitCleanFdx, gitCommitAll, gitInit, + initHeadless, initJSProjectWithProfile, - initNonInteractive, updateAuthAddUserGroups, updatedInitNewEnvWithProfile, } from '@aws-amplify/amplify-e2e-core'; @@ -78,6 +79,7 @@ describe('amplify init', () => { const envName = 'devtest'; const resourceName = 'twoInitDefaultTest'; await initJSProjectWithProfile(projectRoot, { disableAmplifyAppCreation: false, name: resourceName, envName }); - await expect(initNonInteractive(projectRoot)).rejects.toThrowError('Process exited with non zero exit code 1'); + const appId = getAppId(projectRoot); + await expect(initHeadless(projectRoot, envName, appId)).rejects.toThrowError('Process exited with non zero exit code 1'); }); }); From 38a0e3777e1777c6ac0c4f32a6060de3e8310eb8 Mon Sep 17 00:00:00 2001 From: Roshane Pascual Date: Wed, 20 Sep 2023 11:06:21 -0700 Subject: [PATCH 9/9] test: update initHeadless params to be optional --- .../amplify-e2e-core/src/init/initProjectHelper.ts | 14 ++++++++++++-- .../src/__tests__/init-special-case.test.ts | 4 +--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/amplify-e2e-core/src/init/initProjectHelper.ts b/packages/amplify-e2e-core/src/init/initProjectHelper.ts index 3d8d7f63093..976fc07086e 100644 --- a/packages/amplify-e2e-core/src/init/initProjectHelper.ts +++ b/packages/amplify-e2e-core/src/init/initProjectHelper.ts @@ -513,6 +513,16 @@ export function amplifyStatus(cwd: string, expectedStatus: string, testingWithLa }); } -export function initHeadless(cwd: string, envName: string, appId: string): Promise { - return spawn(getCLIPath(), ['init', '--yes', '--envName', envName, '--appId', appId], { cwd, stripColors: true }).runAsync(); +export function initHeadless(cwd: string, envName?: string, appId?: string): Promise { + const cliArgs = ['init', '--yes']; + + if (envName) { + cliArgs.push('--envName', envName); + } + + if (appId) { + cliArgs.push('--appId', appId); + } + + return spawn(getCLIPath(), cliArgs, { cwd, stripColors: true }).runAsync(); } diff --git a/packages/amplify-e2e-tests/src/__tests__/init-special-case.test.ts b/packages/amplify-e2e-tests/src/__tests__/init-special-case.test.ts index fddf320b1a3..f642584e81d 100644 --- a/packages/amplify-e2e-tests/src/__tests__/init-special-case.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/init-special-case.test.ts @@ -4,7 +4,6 @@ import { createNewProjectDir, deleteProject, deleteProjectDir, - getAppId, getBackendAmplifyMeta, getParameters, getProjectMeta, @@ -79,7 +78,6 @@ describe('amplify init', () => { const envName = 'devtest'; const resourceName = 'twoInitDefaultTest'; await initJSProjectWithProfile(projectRoot, { disableAmplifyAppCreation: false, name: resourceName, envName }); - const appId = getAppId(projectRoot); - await expect(initHeadless(projectRoot, envName, appId)).rejects.toThrowError('Process exited with non zero exit code 1'); + await expect(initHeadless(projectRoot)).rejects.toThrowError('Process exited with non zero exit code 1'); }); });