Skip to content

Component tests failing intermittently with uncaught Vite "failed to fetch dynamically imported module" error in CI #25913

@synaptiko

Description

@synaptiko

Current behavior

We started migrating our project from CRA to Vite and we have almost 300 component and 40 E2E Cypress tests in place. Unfortunately, after fixing all the other issues, we are still not able to stabilize our tests since there is always 1 or 2 failing randomly on "Failed to fetch dynamically imported module" errors.

We noticed that it's somehow related to the load of CI. Under some conditions more tests are failing like this, in other times it succeeds. But it's random. We checked our tests and we are pretty sure it's not caused by any logic we have.

We've checked some of the existing issues on Cypress & Vite, tried various workaround but no luck with any of them.

What we think is happening is that Cypress is not waiting for Vite to "boot up" properly and retries don't help with it, only when new spec is run, it works.

Note: it only happens with component tests. For E2E tests we had similar stability issues but we solved them by building production version and then just serving it with vite preview. This made integration tests faster and very stable. Previously they were also timeouting.

Note 2: we have a lot of components and lot of dependencies in our project, we also use MUI as our base. But with CRA we were able to have stable tests, it was just around two times slower. That's why we want to use Vite now.

Note 3: we are running "Component tests" in parallel, currently in 4 groups.

Desired behavior

No random problems with Cypress + Vite combo.

Test code to reproduce

Unfortunately can't provide this since our project is private. And I'm afraid that it's related to project's complexity and that's why we can't easily create another one for reproduction.

Cypress Version

v12.6.0

Node version

v16.18.1

Operating System

Docker Hub image: cypress/included for v12.6.0 version

Debug Logs

No response

Other

No response

Metadata

Metadata

Labels

CIGeneral issues involving running in a CI providerCTIssue related to component testingTriagedIssue has been routed to backlog. This is not a commitment to have it prioritized by the team.npm: @cypress/vite-dev-server@cypress/vite-dev-server package issuesprevent-stalemark an issue so it is ignored by stale[bot]

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions