Skip to content

Conversation

@chargome
Copy link
Member

This pr changes the detection logic for the e2e tests directory.

Before we always ran every test whenever something changed in this dir.
With this change we check for changed files in the test apps and only run all tests if shared code has been changed.

@chargome chargome self-assigned this Jul 18, 2025
cursor[bot]

This comment was marked as outdated.


// Check if only test application files were changed
const changedTestApps = new Set<string>();
const hasSharedCodeChanges = changedFiles.some(file => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO it's a bit weird/unexpected to use some and then collect stuff there 🤔

I think it would be easier to read/follow to extract this into a method like:

function getChangedTestApps(): false | Set<string>

And then do

const changedApps = getChangedTestApps();
if (!changedApps) {
  return testApplication;
}
// return the changed apps only...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can move that into a function but would probably still make use of some so the loop stop whenever we have a match?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactored a bit and replaced some with a basic for loop, hope that's more readable!

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Shared Code Changes Ignored in Test Coverage

Files placed directly in dev-packages/e2e-tests/test-applications/ (not within a specific test app subdirectory) are incorrectly ignored by the getChangedTestApps function. This occurs because the slashIndex > 0 condition prevents processing files where indexOf('/') returns -1. These files, which are effectively shared code, should trigger a full test run (i.e., getChangedTestApps should return false), but their changes are currently missed, leading to incomplete test coverage.

dev-packages/e2e-tests/lib/getTestMatrix.ts#L196-L199

if (slashIndex > 0) {
changedTestApps.add(pathAfterPrefix.slice(0, slashIndex));
}

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

@mydea mydea changed the title test(e2e): Run e2e selectively ci(e2e): Only run changed E2E tests Jul 24, 2025
@mydea mydea force-pushed the cg-e2e-test-selectively branch from ff87af2 to 2691fe6 Compare July 24, 2025 08:44
@mydea mydea merged commit f8c80f7 into develop Jul 24, 2025
144 of 145 checks passed
@mydea mydea deleted the cg-e2e-test-selectively branch July 24, 2025 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants