Skip to content

Commit

Permalink
test(atomic): fix script to scope E2E tests (#4554)
Browse files Browse the repository at this point in the history
## 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>
  • Loading branch information
3 people authored Oct 23, 2024
1 parent 05cb497 commit 9ae81be
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/ci/find-tests.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -122,4 +122,5 @@ try {
}
} catch (error) {
console.warn(error?.message || error);
setOutput(outputName, ''); // Passing an empty string will run all tests.
}

0 comments on commit 9ae81be

Please sign in to comment.