nuxt / test-utils

๐Ÿงช Test utilities for Nuxt
http://nuxt.com/docs/getting-started/testing
MIT License
323 stars 84 forks source link

fix: avoid error message with tsc and nuxt test-utils #911

Closed vbrajon closed 3 months ago

vbrajon commented 3 months ago

๐Ÿ”— Linked issue

โ“ Type of change

๐Ÿ“š Description

An error message like this appears:

[1:39:59 PM] ERROR 1:39:59 PM [vite] Pre-transform error: Failed to resolve import "/@vite-plugin-checker-runtime-entry" from "node_modules/nuxt/dist/app/entry.js". Does the file exist?

With a empty nuxt project and the following config:

npm i --save-dev @nuxt/test-utils vitest @vue/test-utils happy-dom playwright-core
npm i --save-dev @vitest/ui
npm i --save-dev vue-tsc typescript
export default defineNuxtConfig({
  compatibilityDate: "2024-04-03",
  devtools: { enabled: true },
  modules: ["@nuxt/test-utils"],
  typescript: {
    typeCheck: true,
  },
  testUtils: {
    startOnBoot: true,
  },
})

See this reproduction link: https://stackblitz.com/edit/github-hxk7b6