Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Aug 11, 2025

This PR backports the improved e2e testing approach from the main branch to the v3-maintenance branch to reduce flakiness in e2e tests.

Related PRs:

Changes Summary

Replaces the simple e2e test runner in tools/e2e/runIndividualE2EFiles.ts with the improved version from main branch that includes:

Key Improvements

  • Automatic retry mechanism: Failed tests are retried once before being marked as failed
  • Environment variable isolation: Uses WRANGLER_E2E_TEST_FILE to pass specific test files while reusing cached builds
  • Glob-based test discovery: Uses glob patterns (e2e/**/*.test.ts) instead of simple directory reading for more robust file discovery
  • Enhanced error handling: Collects all failed tests and reports them comprehensively at the end
  • GitHub Actions integration: Includes console grouping (::group::) for better CI output organization
  • Command-line argument support: Supports passing additional parameters to Vitest (e.g., -u for snapshot updates)

Technical Details

The main changes include:

  • Added imports for assert, statSync, path, and globIterateSync
  • Replaced readdirSync with globIterateSync for more flexible file discovery
  • Added retry logic with proper error handling
  • Implemented environment variable passing for better caching
  • Added comprehensive error reporting for failed tests

Human Review Checklist

⚠️ High Priority Items:

  • Test the e2e runner locally - Verify pnpm test:e2e:wrangler works on v3-maintenance
  • Check environment variable support - Confirm WRANGLER_E2E_TEST_FILE is properly handled by v3-maintenance test infrastructure
  • Verify glob dependency compatibility - Ensure glob versions are compatible between main and v3-maintenance
  • Review retry logic - Check for potential infinite loops or hanging behavior
  • Test error scenarios - Verify failed tests are properly collected and reported

  • Tests
    • Tests not necessary because: This is a backport of existing functionality that's proven to work on main branch
  • Wrangler E2E Tests CI Job required?
    • Required - This change directly affects e2e test execution
  • Public documentation
    • Documentation not necessary because: Internal tooling improvement with no user-facing changes

Link to Devin run: https://app.devin.ai/sessions/a6bcd0abb9074acea6c9d2b286bce88a
Requested by: @petebacondarwin

⚠️ Note: This PR contains untested changes to critical CI infrastructure. The backport assumes compatibility between main and v3-maintenance branches, but this should be verified through testing before merge.

- Add retry mechanism for failed tests
- Use environment variable isolation with WRANGLER_E2E_TEST_FILE
- Implement glob-based test file discovery
- Add better error handling and reporting
- Include GitHub Actions console grouping

This backports the improved e2e testing approach from main branch
to reduce flakiness in e2e tests on v3-maintenance branch.

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@changeset-bot
Copy link

changeset-bot bot commented Aug 11, 2025

⚠️ No Changeset found

Latest commit: b5ff256

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

The improved e2e runner imports glob directly, so it needs to be
added as a dependency to the tools package.json.

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
@petebacondarwin petebacondarwin added the e2e Run wrangler + vite-plugin e2e tests on a PR label Aug 11, 2025
This resolves the CI failure:
ERR_PNPM_OUTDATED_LOCKFILE Cannot install with "frozen-lockfile" because pnpm-lock.yaml is not up to date with tools/package.json

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
@devin-ai-integration devin-ai-integration bot marked this pull request as ready for review August 11, 2025 07:31
@devin-ai-integration devin-ai-integration bot requested a review from a team as a code owner August 11, 2025 07:31
@petebacondarwin petebacondarwin added the skip-pr-description-validation Skip validation of the required PR description format label Aug 11, 2025
devin-ai-integration bot and others added 5 commits August 11, 2025 08:53
- Add globalPassThroughEnv to root turbo.json with essential environment variables
- Update packages/wrangler/turbo.json with WRANGLER_E2E_TEST_FILE and other missing env vars
- Add passThroughEnv array to build task with comprehensive environment variable list
- Update build inputs to use $TURBO_DEFAULT$ pattern from main branch
- Add create-cloudflare#build dependency to test:e2e task

These changes ensure the backported e2e runner can properly utilize turbo cache
by recognizing the WRANGLER_E2E_TEST_FILE environment variable and other
essential configuration, preventing cache misses that cause test timeouts.

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
…:e2e task

The create-cloudflare#build dependency doesn't exist in v3-maintenance branch,
causing E2E tests to fail with 'Could not find package create-cloudflare from task create-cloudflare#build'.
This fix removes the problematic dependency while keeping the essential WRANGLER_E2E_TEST_FILE
environment variable that enables proper turbo caching for the backported e2e runner.

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
… handling

This ensures the e2e test runner uses the same environment variable handling
pattern as other turbo tasks, optimizing turbo cache behavior.

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
…assing issues

The dotenv prefix was causing the WRANGLER environment variable to not be
passed through properly, causing E2E test validation failures. The core
turbo cache optimizations (env var configuration, dependency fixes) remain
in place and provide the intended performance improvements.

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
Backport the vitest configuration from main branch to properly handle
the WRANGLER_E2E_TEST_FILE environment variable for individual test
file execution. This completes the e2e testing improvements backport.

- Add retry: 1 configuration for automatic test retries
- Add dynamic include pattern using WRANGLER_E2E_TEST_FILE env var
- Fixes E2E test failures by enabling proper test file filtering

Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Aug 12, 2025
@CarmenPopoviciu CarmenPopoviciu merged commit bb14da5 into v3-maintenance Aug 13, 2025
26 of 27 checks passed
@CarmenPopoviciu CarmenPopoviciu deleted the devin/1754894347-backport-e2e-improvements branch August 13, 2025 10:55
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Aug 13, 2025
@workers-devprod workers-devprod added the contribution [Holopin] Recognizes an open-source contribution, big or small label Aug 13, 2025
@holopin-bot
Copy link

holopin-bot bot commented Aug 13, 2025

Congratulations @devin-ai-integration[bot], the maintainer of this repository has issued you a holobyte! Here it is: https://holopin.io/holobyte/cme9utunb033607l1n41cnb0g

This badge can only be claimed by you, so make sure that your GitHub account is linked to your Holopin account. You can manage those preferences here: https://holopin.io/account.
Or if you're new to Holopin, you can simply sign up with GitHub, which will do the trick!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution [Holopin] Recognizes an open-source contribution, big or small e2e Run wrangler + vite-plugin e2e tests on a PR skip-pr-description-validation Skip validation of the required PR description format

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants