e2e testing api routes: "setup" is not exported by "node_modules/unenv/runtime/mock/proxy.mjs"

I'm trying to test my nuxt api routes to make sure they work correctly. I've followed the setup guide from https://nuxt.com/docs/getting-started/testing#end-to-end-testing. But when I try to run the example test from https://nuxt.com/docs/getting-started/testing#setup-1 with vitest, I get the following error: RollupError: server/api/jobs.nuxt.test.ts (2:9): "setup" is not exported by "node_modules/unenv/runtime/mock/proxy.mjs", imported by "server/api/some-route.nuxt.test.ts" Am I missing something obvious here? Additional info: I used the installation command from the setup section, minus playwright-core since I want to use vitest as test runner: npm i --save-dev @nuxt/test-utils vitest @vue/test-utils happy-dom. Full error message:
FAIL server/api/jobs.nuxt.test.ts > My test
RollupError: server/api/jobs.nuxt.test.ts (2:9): "setup" is not exported by "node_modules/unenv/runtime/mock/proxy.mjs", imported by "server/api/some-route.nuxt.test.ts".
1: import { describe, test } from 'vitest'
2: import { setup, $fetch } from '@nuxt/test-utils/e2e'
^
3:
4: describe('My test', async () => {
FAIL server/api/jobs.nuxt.test.ts > My test
RollupError: server/api/jobs.nuxt.test.ts (2:9): "setup" is not exported by "node_modules/unenv/runtime/mock/proxy.mjs", imported by "server/api/some-route.nuxt.test.ts".
1: import { describe, test } from 'vitest'
2: import { setup, $fetch } from '@nuxt/test-utils/e2e'
^
3:
4: describe('My test', async () => {
Nuxt
Testing · Get Started with Nuxt
How to test your Nuxt application.
1 Reply
Tackleberry
TackleberryOP5mo ago
No one here who uses e2e testing with nuxt? 😦
Want results from more Discord servers?
Add your server