Skip to content

fix(logger): improve e2e test resilience by grouping logs by level - #4909

Merged
svozza merged 2 commits into
mainfrom
fix/logger-e2e-test-ordering
Jan 5, 2026
Merged

svozza merged 2 commits into
mainfrom
fix/logger-e2e-test-ordering

Conversation

@dreamorosi

Copy link
Copy Markdown
Contributor

Summary

Changes

This PR improves the resilience of Logger e2e tests by replacing strict array index assertions with log level grouping, fixing intermittent test failures in advancedUses.test.ts.

Issue number: closes #4907

The Logger e2e tests were failing intermittently (~40% failure rate) due to inconsistent log ordering when uncaught errors occur. The tests expected logs in a specific sequence, but the uncaught error handler could flush logs in different order, causing assertions to fail on array indices.

Solution

  • Group logs by level before assertions rather than expecting strict micro-ordering during error conditions
  • Assert on log content rather than array positions for INFO, DEBUG, and ERROR logs
  • Maintain test coverage while improving reliability for CI
  • No core logger changes required - only test improvements

Benefits

  • CI Stability: Eliminates intermittent test failures that reduce confidence in the test suite
  • Developer Experience: Reduces time wasted investigating false failures
  • Test Reliability: Aligns with real-world logging behavior during error conditions
  • Maintenance: Reduces need for manual re-runs when tests fail intermittently

Testing

  • Verified the fix resolves intermittent failures through multiple test runs
  • Maintains the same validation coverage as before
  • Tests now focus on log completeness rather than exact ordering during errors

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

- Replace strict array index assertions with log level grouping
- Assert on log content rather than micro-ordering during error conditions
- Maintains test coverage while improving reliability for CI
- Fixes intermittent failures in advancedUses.test.ts (~40% failure rate)

Closes #4907
@boring-cyborg boring-cyborg Bot added the tests PRs that add or change tests label Jan 5, 2026
@pull-request-size pull-request-size Bot added the size/M PR between 30-99 LOC label Jan 5, 2026
@dreamorosi

Copy link
Copy Markdown
Contributor Author

This branch was previously deployed

1 inactive deployment
e2e-tests — dfb6d733 Deployed Jan 5, 2026 by dreamorosi via run-e2e-tests-on-utils (layers, 24, arm64) #768
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M PR between 30-99 LOC tests PRs that add or change tests

3 participants