web
web copied to clipboard
`TypeError: Failed to fetch dynamically imported module` only in Windows in GitHub Actions
When I run tests locally in Windows, they work fine.
For some reason, import of some files is not working in Windows in CI (GitHub Actions):
https://github.com/lume/lume/actions/runs/6702225570/job/18211044889?pr=287
The output (in the test section) shows this:
dist\behaviors\DefaultBehaviors.test.js:
🚧 Browser logs:
TypeError: Failed to fetch dynamically imported module: http://localhost:3366/dist/behaviors/DefaultBehaviors.test.js?wtr-session-id=6Dp5Mh8y1PNtD5fvis4Cz&wds-import-map=0
❌ Could not import your test module. Check the browser logs or open the browser in debug mode for more information.
dist\core\Element3D.test.js:
🚧 Browser logs:
TypeError: Failed to fetch dynamically imported module: http://localhost:3366/dist/core/Element3D.test.js?wtr-session-id=ec1wUB4LLodIFFBMIYLR2&wds-import-map=0&wds-import-map=0
❌ Could not import your test module. Check the browser logs or open the browser in debug mode for more information.
The files for the commit of that build exist though:
- https://github.com/lume/lume/blob/8d42210b1e39f73197b660f366cf863b7c8a43c4/dist/behaviors/DefaultBehaviors.test.js
- https://github.com/lume/lume/blob/8d42210b1e39f73197b660f366cf863b7c8a43c4/dist/core/Element3D.test.js
The test-runner config is here:
- https://github.com/lume/cli/blob/bc2e53ca851657570b2d79d6a35f7093452fa314/config/web-test-runner.config.mjs
The config is in the @lume/cli package, which is a git submodule in lume's main repo linked to the top-level node_modules with yarn workspaces.
I wonder what could possibly be causing this.
It's always Windows isn't it!
If I understood your correctly, it works for you on Windows, only locally, but not in CI. From the error log I can't say why it happens, but just by the fact that it breaks in CI only makes me think that it's CI related issue rather than a WTR one.
I'd suggest to try to reproduce it locally, e.g. by using same config instead of switching it depending on the CI like in
// Override the default Chrome launcher with Playwright launcher so to test
// in all browsers in CI.
browsers: process.env.CI
? [playwrightLauncher({product: 'chromium'})]
: // undefined defaults to Chrome (must be locally installed)
undefined,