webdriverio/webdriverio

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

开放

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

 (9 条评论) (0 个反应) (0 位负责人)JavaScript (1,793 个派生)batch import
Bug 🐛help wanted

仓库指标

星标
 (6,029 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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

贡献者指南