Skip to content

Conversation

@dreamorosi
Copy link
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
@svozza svozza merged commit 5f06f21 into main Jan 5, 2026
91 checks passed
@svozza svozza deleted the fix/logger-e2e-test-ordering branch January 5, 2026 16:57
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Maintenance: Fix intermittent Logger e2e test failures due to log ordering inconsistency

3 participants