diff --git a/packages/amplify-e2e-tests/package.json b/packages/amplify-e2e-tests/package.json index 59360a9f6ac..ddd2f3e10af 100644 --- a/packages/amplify-e2e-tests/package.json +++ b/packages/amplify-e2e-tests/package.json @@ -59,7 +59,7 @@ "/node_modules/", "lib" ], - "collectCoverage": true, + "collectCoverage": false, "collectCoverageFrom": [ "src/**/*.ts", "!**/node_modules/**", diff --git a/packages/amplify-e2e-tests/src/__tests__/env.test.ts b/packages/amplify-e2e-tests/src/__tests__/env.test.ts index 076930121a3..48054f9f910 100644 --- a/packages/amplify-e2e-tests/src/__tests__/env.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/env.test.ts @@ -1,6 +1,10 @@ import { + addAuthWithCustomTrigger, addAuthWithDefault, + addAuthWithDefaultSocial, + addAuthWithRecaptchaTrigger, amplifyPull, + amplifyPushAuth, amplifyPushUpdate, checkIfBucketExists, createNewProjectDir, @@ -8,20 +12,16 @@ import { deleteProjectDir, getProjectMeta, initJSProjectWithProfile, - addAuthWithCustomTrigger, - amplifyPushAuth, - addAuthWithRecaptchaTrigger, - addAuthWithDefaultSocial, } from 'amplify-e2e-core'; import { addEnvironment, + addEnvironmentHostedUI, checkoutEnvironment, getEnvironment, importEnvironment, listEnvironment, pullEnvironment, removeEnvironment, - addEnvironmentHostedUI, } from '../environment/env'; async function validate(meta: any) { @@ -70,8 +70,7 @@ describe('environment commands', () => { }); }); -/* Disabling test for now */ -describe.skip('cross project environment commands', () => { +describe('cross project environment commands', () => { let projRoot: string; beforeEach(async () => { projRoot = await createNewProjectDir('import-env-test'); @@ -86,8 +85,8 @@ describe.skip('cross project environment commands', () => { await initJSProjectWithProfile(projRoot, { envName: 'env' }); await addAuthWithDefault(projRoot, {}); const providerConfig: string = await getEnvironment(projRoot, { envName: 'env' }); - expect(providerConfig === JSON.stringify(JSON.parse(providerConfig))).toBeTruthy(); await amplifyPushUpdate(projRoot); + let projRoot2: string; try { projRoot2 = await createNewProjectDir('import-env-test2'); @@ -95,10 +94,7 @@ describe.skip('cross project environment commands', () => { await importEnvironment(projRoot2, { providerConfig, envName: 'env' }); await validate(getProjectMeta(projRoot)); await validate(getProjectMeta(projRoot2)); - } catch (e) { - console.error(e); } finally { - await deleteProject(projRoot2); deleteProjectDir(projRoot2); } }); diff --git a/packages/amplify-e2e-tests/src/environment/env.ts b/packages/amplify-e2e-tests/src/environment/env.ts index bf8f66d891c..bf0a9c7f4de 100644 --- a/packages/amplify-e2e-tests/src/environment/env.ts +++ b/packages/amplify-e2e-tests/src/environment/env.ts @@ -113,9 +113,9 @@ export function listEnvironment(cwd: string, settings: { numEnv?: number }): Pro // Get environment details and return them as JSON export function getEnvironment(cwd: string, settings: { envName: string }): Promise { const envData = {}; - let helper = output => { - let keyVal = output.split(/:(.+)/); // Split string on first ':' only - envData[keyVal[0].trim()] = keyVal[1].trim(); + const helper = (output: string) => { + const [key, value] = output.split(/:(.+)/); // Split string on first ':' only + envData[key.trim()] = value.trim(); }; return new Promise((resolve, reject) => { spawn(getCLIPath(), ['env', 'get', '--name', settings.envName], { cwd, stripColors: true }) @@ -124,6 +124,7 @@ export function getEnvironment(cwd: string, settings: { envName: string }): Prom .wait('Provider') .wait('AuthRoleName', helper) .wait('UnauthRoleArn', helper) + .wait(/^AuthRoleArn/, helper) // Needs to be a regex to prevent matching UnauthRoleArn twice .wait('Region', helper) .wait('DeploymentBucketName', helper) .wait('UnauthRoleName', helper) @@ -132,10 +133,8 @@ export function getEnvironment(cwd: string, settings: { envName: string }): Prom .wait('--------------') .sendEof() .run((err: Error) => { - let jsonEnvData = JSON.stringify({ awscloudformation: envData }); if (!err) { - resolve(jsonEnvData); - return jsonEnvData; + resolve(JSON.stringify({ awscloudformation: envData })); } else { reject(err); } diff --git a/packages/amplify-migration-tests/package.json b/packages/amplify-migration-tests/package.json index 596307fc4a9..c98bd6aa5e6 100644 --- a/packages/amplify-migration-tests/package.json +++ b/packages/amplify-migration-tests/package.json @@ -49,7 +49,7 @@ "/node_modules/", "lib" ], - "collectCoverage": true, + "collectCoverage": false, "collectCoverageFrom": [ "src/**/*.ts", "!**/node_modules/**",