WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Flaky E2E tests - Cannot resolve import("#app/nuxt-vitest-app-entry") #1386

@JessicaSachs

Description

@JessicaSachs

Environment

  • Operating System: Darwin
  • Node Version: v22.17.1
  • Nuxt Version: 4.0.3
  • CLI Version: 3.28.0
  • Nitro Version: 2.12.4
  • Package Manager: [email protected]
  • Builder: -
  • User Config: compatibilityDate, devtools, modules
  • Runtime Modules: @nuxt/[email protected]
  • Build Modules: -

Reproduction

https://github.com/JessicaSachs/nuxt-vitest-flake-repro

I'm looking to use host in order to point my e2e tests at an already-built Nuxt application. To run the suite, first build the application:

pnpm build

And then run the tests via:

pnpm test:e2e

Describe the bug

I'm unable to run tests reliably. The E2E test run exits after first suite (Either Node or Nuxt) passes. I get flake 20% of the time. My coworker gets it about 80% of the time. Pretty sure it's related to the machine speed.

Additional context

I've tried doing things like forcing Vitest's parallelization to turn off and poolOptions/maxThreads to be 1. Can't find a workaround rn.

Logs

FAIL   nuxt  test/e2e/home.test.ts [ test/e2e/home.test.ts ]
Error: Failed to resolve import "#app/nuxt-vitest-app-entry" from "node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]_playwri_9da3baa23bc5990d9fca0e90d773c266/node_modules/@nuxt/test-utils/dist/runtime/shared/nuxt.mjs". Does the file exist?
  Plugin: vite:import-analysis
  File: /Users/jess/projects/jess-ecosystem/nuxt-vitest-flake-repro/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]_playwri_9da3baa23bc5990d9fca0e90d773c266/node_modules/@nuxt/test-utils/dist/runtime/shared/nuxt.mjs:3:15
  1  |  export async function setupNuxt() {
  2  |    const { useRouter } = await import("#app/composables/router");
  3  |    await import("#app/nuxt-vitest-app-entry").then((r) => r.default());
     |                 ^
  4  |    const nuxtApp = useNuxtApp();
  5  |    await nuxtApp.callHook("page:finish");
Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions