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

Web Test Runner terminates randomly without logs #2636

Open
jonkoops opened this issue Feb 5, 2024 · 5 comments
Open

Web Test Runner terminates randomly without logs #2636

jonkoops opened this issue Feb 5, 2024 · 5 comments

Comments

@jonkoops
Copy link

jonkoops commented Feb 5, 2024

We're porting the Leaflet testsuite from Karma to Web Test Runner, and noticed that the test run seems to terminate seemingly at random. This can be reproduced by running the Leaflet tests in watch mode.

@jonkoops
Copy link
Author

jonkoops commented Feb 5, 2024

This issue is now also occurring in regular test runs on our CI.

@mourner
Copy link

mourner commented Feb 5, 2024

We've narrowed it down to this line which is apparently causing WTR to crash (while it worked fine with Karma):

Object.defineProperty(window, 'navigator', {value: ...});

@jonkoops
Copy link
Author

jonkoops commented Feb 5, 2024

Aside from the crash itself, I think the main problem here is the lack of logging. It's not really possible to understand where this crash was coming from at a glance.

@bashmish
Copy link
Member

Can you try to configure concurrency: 1 (https://modern-web.dev/docs/test-runner/cli-and-configuration/)?

As for the logs: you might need to setup browserLogs and filterBrowserLogs, but I think defaults should be good already. Maybe the logs are not displayed because of the CI env? Locally I used Playwright a lot with WTR and saw error logs a lot of times, so not sure what the problem can be, I suggest to debug a little bit with different settings.

@jonkoops
Copy link
Author

We've already tried lowering the concurrency to no avail. We have been able to narrow down the problem to the fact that Web Test Runner requires navigator.userAgent and navigator.serviceWorker to function.

We should not be overwriting these in our test suite, but I still think error reporting by Web Test Runner could be improved here.

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

No branches or pull requests

3 participants