From 9ae81be667b5cba01310d3d21c06f29987711530 Mon Sep 17 00:00:00 2001 From: ylakhdar Date: Wed, 23 Oct 2024 15:43:43 -0400 Subject: [PATCH] test(atomic): fix script to scope E2E tests (#4554) ## 2 issues fixed: 1. Incorrect Error Handling: When the script detects a file change from another package (e.g., headless/), it throws an error but does not set the `testsToRun` variable. This causes the CI to fail. 2. False Positive Detection: The script incorrectly detects changes in `headless-react` as changes in `headless`, leading to the execution of all tests unnecessarily. https://coveord.atlassian.net/browse/KIT-3667 --------- Co-authored-by: developer-experience-bot[bot] <91079284+developer-experience-bot[bot]@users.noreply.github.com> Co-authored-by: Alex Prudhomme <78121423+alexprudhomme@users.noreply.github.com> --- scripts/ci/find-tests.mjs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/ci/find-tests.mjs b/scripts/ci/find-tests.mjs index a8d0b11bdcb..ccf609fc719 100644 --- a/scripts/ci/find-tests.mjs +++ b/scripts/ci/find-tests.mjs @@ -92,12 +92,12 @@ function determineTestFilesToRun(changedFiles, testDependencies) { function ensureIsNotCoveoPackage(file) { if (dependsOnCoveoPackage(file)) { - throw new Error('Change detected in an different Coveo package.'); + throw new Error(`Change detected in an different Coveo package: ${file}`); } } function dependsOnCoveoPackage(file) { - const externalPackages = ['packages/headless', 'packages/bueno']; + const externalPackages = ['packages/headless/', 'packages/bueno/']; for (const pkg of externalPackages) { if (file.includes(pkg)) { return true; @@ -122,4 +122,5 @@ try { } } catch (error) { console.warn(error?.message || error); + setOutput(outputName, ''); // Passing an empty string will run all tests. }