You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I installed Vitest and nuxt/test-utils as stated in the documentation, but when running a simple test, like expecting a sum to have a certain result, the test runs without issues. However, when I import mountSuspended and run the test calling it, I receive the error: error: Cannot find package '#imports' from 'D:\projects\barberShop\b2c-app\node_modules@nuxt\test-utils\dist\runtime-utils\index.mjs'.
The test file is named as in the documentation, my-file.nuxt.test.ts, and I am also using the same test as in the example. Still, I keep receiving this error when running the test. I removed and reinstalled the packages, but nothing resolves the issue. My files are as follows:
import { it, expect } from "vitest";
// ---cut---
// tests/components/SomeComponents.nuxt.spec.ts
import { mountSuspended } from "@nuxt/test-utils/runtime";
import App from "~/app.vue";
// tests/App.nuxt.spec.ts
it("can also mount an app", async () => {
const component = await mountSuspended(App, { route: "/test" });
expect(component.html()).toMatchInlineSnapshot(`
"<div>This is an auto-imported component</div>
<div> I am a global component </div>
<div>/</div>
<a href="/test"> Test link </a>"
`);
});
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello, I installed Vitest and nuxt/test-utils as stated in the documentation, but when running a simple test, like expecting a sum to have a certain result, the test runs without issues. However, when I import mountSuspended and run the test calling it, I receive the
error: error: Cannot find package '#imports' from 'D:\projects\barberShop\b2c-app\node_modules@nuxt\test-utils\dist\runtime-utils\index.mjs'
.The test file is named as in the documentation,
my-file.nuxt.test.ts
, and I am also using the same test as in the example. Still, I keep receiving this error when running the test. I removed and reinstalled the packages, but nothing resolves the issue. My files are as follows://nuxt.config.ts
//vitest.config.ts
and my package.json
Beta Was this translation helpful? Give feedback.
All reactions