From 3f84c7566dbeb03ee7e16384b797bc250b9d3287 Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Fri, 18 Oct 2024 14:10:30 -0700 Subject: [PATCH] test(scripts): skip preview legacy:e2e tests if client is not found (#6576) --- tests/e2e-legacy/preview.mjs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/e2e-legacy/preview.mjs b/tests/e2e-legacy/preview.mjs index db864e76c8a7..4bde8c05bfa2 100755 --- a/tests/e2e-legacy/preview.mjs +++ b/tests/e2e-legacy/preview.mjs @@ -11,22 +11,24 @@ const __dirname = getDirName(); const execOptions = { ...process, cwd: __dirname, encoding: "utf-8" }; const commitsSinceOriginHead = execSync(`git log --oneline origin/main..HEAD --format=%s`, execOptions).split("\n"); -const updatedClients = new Set(); +const updatedClientsSet = new Set(); for (const commitMessage of commitsSinceOriginHead) { const prefix = commitMessage.split(":")[0]; const scope = prefix.substring(prefix.indexOf("(") + 1, prefix.indexOf(")")); if (scope && scope.startsWith("client-")) { - updatedClients.add(`@aws-sdk/${scope}`); + updatedClientsSet.add(`@aws-sdk/${scope}`); } } + +const updatedClients = [...updatedClientsSet]; console.info(`Updated packages: ${updatedClients}`); -if (updatedClients.size === 0) { +if (updatedClients.length === 0) { console.info(`Couldn't find clients in commit messages:\n '${commitsSinceOriginHead.join("\n")}'`); - process.exit(1); + process.exit(0); } const allTags = getAllTags(); -const changedPackageTags = getPackageTags([...updatedClients]); +const changedPackageTags = getPackageTags(updatedClients); const tagsToTest = changedPackageTags.filter((tag) => allTags.includes(tag)); runTestForTags(tagsToTest);