Skip to content

Commit

Permalink
test(scripts): skip preview legacy:e2e tests if client is not found (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr authored Oct 18, 2024
1 parent 9e92f06 commit 3f84c75
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tests/e2e-legacy/preview.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

0 comments on commit 3f84c75

Please sign in to comment.