Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky browser tests #484

Merged
merged 6 commits into from
Jan 13, 2023

Conversation

cristobal
Copy link
Contributor

@cristobal cristobal commented Jan 12, 2023

The browser tests were flaky due to the reason that the server.close() call was slow sometimes due to open connection kept alive, which is default server behaviour. Resulting in false pending tests assertiions that are actually finished but never finish and times out due to that the server is not closed within the expected timeout.

What's done

  • Added middleware that ensures that the connections are closed after response is sent (@see stackoverflow here)
  • Added beforeEach and afterEach methods that setups and closes server for each test.
  • All the tests are also now serial which is needed since we only have one server that is setup and teardown per test as mentioned above (also playwright is not that good with parallell running browsers either way).
  • Enabled the github workflow matrix to also run for node versions 16 and 18.
  • Fixed import of UntitledMacro that has been renamed to Implementation.

NOTES:

  • Tried to avoid adding the beforeEach and afterEach methods that setups and closes the server. Unless done this way the browser tests keep beeing flaky 🤷🏽 .

@sindresorhus sindresorhus merged commit 78a44c0 into sindresorhus:main Jan 13, 2023
@sindresorhus
Copy link
Owner

Thanks for fixing that 👍

@cristobal cristobal deleted the fix-flaky-browser-tests branch January 14, 2023 12:32
@cristobal
Copy link
Contributor Author

Thanks for fixing that 👍

Thanks for creating ky 👋🏽

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants