Skip to content

Flaky test: test/specs/monitoring/filtering-endpoints.spec.ts #2631

@ngallegos

Description

@ngallegos

Describe the bug

Description

Occasionally a CI build will fail due to the test in test/specs/monitoring/filtering-endpoints.spec.ts. An example is https://github.com/Particular/ServicePulse/actions/runs/17587478379/job/49959282726. Re-running the build will generally succeed

Steps to reproduce

Run a CI build

Relevant log output


Vitest caught 2 unhandled errors during the test run.
This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.

⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯
ReferenceError: window is not defined
 ❯ stopTimer src/composables/autoRefresh.ts:12:7
     10|   function stopTimer() {
     11|     if (refreshInterval !== null) {
     12|       window.clearTimeout(refreshInterval);
       |       ^
     13|       refreshInterval = null;
     14|     }
 ❯ startTimer src/composables/autoRefresh.ts:20:5
 ❯ executeAndResetTimer src/composables/autoRefresh.ts:31:7
 ❯ Timeout._onTimeout src/composables/autoRefresh.ts:22:7
 ❯ listOnTimeout node:internal/timers:588:17
 ❯ processTimers node:internal/timers:523:7

This error originated in "test/specs/monitoring/filtering-endpoints.spec.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.
This error was caught after test environment was torn down. Make sure to cancel any running tasks before test finishes:
- cancel timeouts using clearTimeout and clearInterval
- wait for promises to resolve using the await keyword

⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯
ReferenceError: window is not defined
 ❯ stopTimer src/composables/autoRefresh.ts:12:7
     10|   function stopTimer() {
     11|     if (refreshInterval !== null) {
     12|       window.clearTimeout(refreshInterval);
       |       ^
     13|       refreshInterval = null;
     14|     }
 ❯ startTimer src/composables/autoRefresh.ts:20:5
 ❯ executeAndResetTimer src/composables/autoRefresh.ts:31:7
 ❯ Timeout._onTimeout src/composables/autoRefresh.ts:22:7
 ❯ listOnTimeout node:internal/timers:588:17
 ❯ processTimers node:internal/timers:523:7

This error originated in "test/specs/monitoring/filtering-endpoints.spec.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.
This error was caught after test environment was torn down. Make sure to cancel any running tasks before test finishes:
- cancel timeouts using clearTimeout and clearInterval
- wait for promises to resolve using the await keyword
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

Additional Information

There is an ongoing PR attempt to fix this: #2630, however, it has taken more time than could be afforded for the monthly .NET runtime releases.

Workarounds

Re-running the build may be successful.

Possible solutions

Additional information

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions