Skip to content

Commit 0fda7d7

Browse files
committed
address CRs
1 parent 1fca1b8 commit 0fda7d7

File tree

3 files changed

+6
-25
lines changed

3 files changed

+6
-25
lines changed

packages/amplify-e2e-core/src/init/deleteProject.ts

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,16 @@ import { getBackendAmplifyMeta } from '../utils';
88
* Runs `amplify delete`
99
*/
1010
// eslint-disable-next-line @typescript-eslint/no-explicit-any
11-
export const deleteProject = async (cwd: string, profileConfig?: any, usingLatestCodebase = false): Promise<void> => {
11+
export const deleteProject = async (cwd: string, profileConfig?: any, usingLatestCodebase = false, noOutputTimeout: number = 1000 * 60 * 20): Promise<void> => {
1212
// Read the meta from backend otherwise it could fail on non-pushed, just initialized projects
1313
const { StackName: stackName, Region: region } = getBackendAmplifyMeta(cwd).providers.awscloudformation;
1414
await retry(
1515
() => describeCloudFormationStack(stackName, region, profileConfig),
1616
stack => stack.StackStatus.endsWith('_COMPLETE') || stack.StackStatus.endsWith('_FAILED'),
1717
);
18-
19-
const noOutputTimeout = 1000 * 60 * 20; // 20 minutes;
2018
return spawn(getCLIPath(usingLatestCodebase), ['delete'], { cwd, stripColors: true, noOutputTimeout })
2119
.wait('Are you sure you want to continue?')
2220
.sendConfirmYes()
2321
.wait('Project deleted locally.')
2422
.runAsync();
25-
};
26-
27-
export const amplifyDeleteWithLongerTimeout = (cwd: string, usingLatestCodebase = false): Promise<void> => new Promise((resolve, reject) => {
28-
const noOutputTimeout = 1000 * 60 * 30; // 30 minutes;
29-
spawn(getCLIPath(usingLatestCodebase), ['delete'], { cwd, stripColors: true, noOutputTimeout })
30-
.wait('Are you sure you want to continue?')
31-
.sendConfirmYes()
32-
.wait('Project deleted locally.')
33-
.run((err: Error) => {
34-
if (!err) {
35-
resolve();
36-
} else {
37-
reject(err);
38-
}
39-
});
40-
});
23+
};

packages/amplify-e2e-tests/src/__tests__/api_6a.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ const projName = 'apitest';
1616
let projRoot;
1717
beforeEach(async () => {
1818
projRoot = await createNewProjectDir(projName);
19+
await initJSProjectWithProfile(projRoot, { name: projName });
20+
await addApiWithoutSchema(projRoot, { transformerVersion: 2 });
1921
});
2022
afterEach(async () => {
2123
await deleteProject(projRoot);
@@ -24,8 +26,6 @@ afterEach(async () => {
2426

2527
describe('amplify rebuild api', () => {
2628
it('recreates single table', async () => {
27-
await initJSProjectWithProfile(projRoot, { name: projName });
28-
await addApiWithoutSchema(projRoot, { transformerVersion: 2 });
2929
await amplifyPush(projRoot);
3030
const projMeta = getProjectMeta(projRoot);
3131
const apiId = projMeta?.api?.[projName]?.output?.GraphQLAPIIdOutput;
@@ -37,8 +37,6 @@ describe('amplify rebuild api', () => {
3737
await testTableAfterRebuildApi(apiId, region, 'Todo');
3838
});
3939
it('recreates tables for relational models', async () => {
40-
await initJSProjectWithProfile(projRoot, { name: projName });
41-
await addApiWithoutSchema(projRoot, { transformerVersion: 2 });
4240
await updateApiSchema(projRoot, projName, 'relational_models_v2.graphql');
4341
await amplifyPush(projRoot);
4442
const projMeta = getProjectMeta(projRoot);

packages/amplify-e2e-tests/src/__tests__/api_6c.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
rebuildApi,
88
getProjectMeta,
99
updateApiSchema,
10-
amplifyDeleteWithLongerTimeout,
10+
deleteProject
1111
} from '@aws-amplify/amplify-e2e-core';
1212
import { testTableAfterRebuildApi, testTableBeforeRebuildApi } from '../rebuild-test-helpers';
1313

@@ -18,7 +18,7 @@ beforeEach(async () => {
1818
projRoot = await createNewProjectDir(projName);
1919
});
2020
afterEach(async () => {
21-
await amplifyDeleteWithLongerTimeout(projRoot);
21+
await deleteProject(projRoot, undefined, false, 1000 * 60 * 30);
2222
deleteProjectDir(projRoot);
2323
});
2424

0 commit comments

Comments
 (0)