storybookjs / storybook

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation
https://storybook.js.org
MIT License
84.15k stars 9.25k forks source link

CI Flake: BootstrapQueue.test.ts #28439

Closed yannbf closed 1 month ago

yannbf commented 3 months ago

Code: https://github.com/storybookjs/storybook/blob/next/code/frameworks/angular/src/client/angular-beta/utils/BootstrapQueue.test.ts

Flake: https://app.circleci.com/pipelines/github/storybookjs/storybook/79402/workflows/dc88f162-574a-432d-a936-848fb9fe8c07/jobs/676408

greptile-apps[bot] commented 3 months ago

To address the CI flake in BootstrapQueue.test.ts, consider the following steps:

  1. Ensure consistent test environment: Verify that the test environment is correctly set up and torn down in beforeEach and afterEach hooks.

  2. Increase wait intervals: Modify the instantWaitFor function to use a slightly longer interval to account for potential timing issues:

    const instantWaitFor = (fn: () => void) => {
     return vi.waitFor(fn, {
       interval: 10,
     });
    };
  3. Add more robust error handling: Ensure that any asynchronous operations are properly caught and handled to prevent unhandled promise rejections.

  4. Check for race conditions: Review the test cases to ensure there are no race conditions, especially in the queueBootstrapping function calls.

  5. Stabilize async operations: Ensure that all Subject instances are properly completed or errored to avoid hanging promises.

These steps should help in reducing the flakiness of the tests.

References

/code/frameworks/angular/src/client/angular-beta/utils/BootstrapQueue.test.ts

#### About Greptile This response provides a starting point for your research, not a precise solution. Help us improve! Please leave a ๐Ÿ‘ if this is helpful and ๐Ÿ‘Ž if it is irrelevant. [Ask Greptile](https://app.greptile.com/chat/github/storybookjs/storybook/next) ยท [Edit Issue Bot Settings](https://app.greptile.com/apps/github)
kasperpeulen commented 2 months ago

Not flaky anymore

vanessayuenn commented 1 month ago

Still flakey: https://app.circleci.com/pipelines/github/storybookjs/storybook/82380/workflows/71848b95-5f53-4572-9eec-9764c25595a5/jobs/695419