diff --git a/.circleci/scan_artifacts_codebuild.ts b/.circleci/scan_artifacts_codebuild.ts index be790c1af7f..c396b3e89ba 100755 --- a/.circleci/scan_artifacts_codebuild.ts +++ b/.circleci/scan_artifacts_codebuild.ts @@ -13,7 +13,7 @@ export const hasMatchingContentInFolder = (patterns: string[], folder: string, e try { execa.sync('grep', ['-r', `--exclude-dir=${excludeFolder}`, ...patternParam, folder]); return true; - } catch (e) { + } catch (e: any) { // When there is no match exit code is set to 1 if (e.exitCode === 1) { return false; diff --git a/codebuild_specs/run_e2e_tests_windows.yml b/codebuild_specs/run_e2e_tests_windows.yml index a7527b52160..9a00c8594cb 100644 --- a/codebuild_specs/run_e2e_tests_windows.yml +++ b/codebuild_specs/run_e2e_tests_windows.yml @@ -29,3 +29,8 @@ phases: - bash ./codebuild_specs/scripts-windows/load-e2e-cache.sh - bash ./codebuild_specs/scripts-windows/rename-packaged-cli.sh - bash ./codebuild_specs/scripts-windows/run-e2e-windows.sh +artifacts: + files: + - '$E2E_TEST_COVERAGE_DIR/*' + - amplify-e2e-reports/* + base-directory: packages/amplify-e2e-tests/ diff --git a/packages/amplify-e2e-core/src/categories/api.ts b/packages/amplify-e2e-core/src/categories/api.ts index 468cf2fc291..1ba124da7c3 100644 --- a/packages/amplify-e2e-core/src/categories/api.ts +++ b/packages/amplify-e2e-core/src/categories/api.ts @@ -22,7 +22,13 @@ import { multiSelect, singleSelect } from '../utils/selectors'; import { selectRuntime, selectTemplate } from './lambda-function'; import { modifiedApi } from './resources/modified-api-index'; +const isWindowsPlatform = (): boolean => !!process?.platform?.startsWith('win'); + export function getSchemaPath(schemaName: string): string { + // This condition is to account for a difference in the use of __dirname and paths in CodeBuild Windows jobs + if (process.env.CODEBUILD_SRC_DIR && isWindowsPlatform()) { + return path.join(process.env.CODEBUILD_SRC_DIR, 'packages', 'amplify-e2e-tests', 'schemas', schemaName); + } return path.join(__dirname, '..', '..', '..', 'amplify-e2e-tests', 'schemas', schemaName); } diff --git a/packages/amplify-e2e-core/src/utils/index.ts b/packages/amplify-e2e-core/src/utils/index.ts index 71d4d5fb8d7..19652691bf6 100644 --- a/packages/amplify-e2e-core/src/utils/index.ts +++ b/packages/amplify-e2e-core/src/utils/index.ts @@ -175,8 +175,12 @@ export const getFunctionSrcNode = (root: string, functionName: string, fileName return fs.readFileSync(indexPath).toString(); }; +const isWindowsPlatform = (): boolean => !!process?.platform?.startsWith('win'); + const getTestFileNamePath = (fileName: string): string => - path.join(__dirname, '..', '..', '..', 'amplify-e2e-tests', 'functions', fileName); + process.env.CODEBUILD_SRC_DIR && isWindowsPlatform() + ? path.join(process.env.CODEBUILD_SRC_DIR, 'packages', 'amplify-e2e-tests', 'functions', fileName) // This condition is to account for a difference in the use of __dirname and paths in CodeBuild Windows jobs + : path.join(__dirname, '..', '..', '..', 'amplify-e2e-tests', 'functions', fileName); const getPathToFunction = (root: string, funcName: string): string => path.join(root, 'amplify', 'backend', 'function', funcName); const getPathToLayer = (root: string, layerProjectName: LayerDirectoryType): string => path.join(root, 'amplify', 'backend', 'function', getLayerDirectoryName(layerProjectName));