webdriverio/webdriverio

[🐛 Bug]: Better resolve dynamic imports in browser tests

Open

#12,056 创建于 2024年1月20日

在 GitHub 查看
 (9 评论) (0 反应) (0 负责人)JavaScript (6,029 star) (1,793 fork)batch import
Bug 🐛help wanted

描述

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

latest

Node.js Version

latest

Mode

WDIO Testrunner

Which capabilities are you using?

n/a

What happened?

When running browser tests and importing CJS modules through Vite, it sometimes happen that we get the following error:

Error:  Test failed due to following error(s):
  - pr-eact.test.tsx: Failed to fetch dynamically imported module: http://localhost:39259/node_modules/.vite/deps/@testing-library_preact.js?v=60c2fbb0: TypeError: Failed to fetch dynamically imported module: http://localhost:39259/node_modules/.vite/deps/@testing-library_preact.js?v=60c2fbb0

Usually it resolves when reloading the page which is why we look for this error in the browser runner. However we have experienced in our build that sometimes even reloading doesn't resolve the issue.

What is your expected behavior?

The CJS transformation should work flawlessly, the error should not appear.

How to reproduce the bug.

Unskip this test and run it in CI.

Relevant log output

- pr-eact.test.tsx: Failed to fetch dynamically imported module: http://localhost:39259/node_modules/.vite/deps/@testing-library_preact.js?v=60c2fbb0: TypeError: Failed to fetch dynamically imported module: http://localhost:39259/node_modules/.vite/deps/@testing-library_preact.js?v=60c2fbb0

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

贡献者指南

[🐛 Bug]: Better resolve dynamic imports in browser tests · webdriverio/webdriverio#12056 | Good First Issue