nuxt-hub / core

Build full-stack applications with Nuxt on CloudFlare, with zero configuration.
https://hub.nuxt.com
Apache License 2.0
937 stars 53 forks source link

Strange incompatability with tests #249

Closed OhB00 closed 1 month ago

OhB00 commented 1 month ago

Describe the bug Essentially, I cannot get tests to run when the @nuxthub/core module is installed. I don't have any concrete evidence that NuxtHub is the cause, but I cannot find any other configuration change that resolves this issue. It seems like it is loosely linked.

Steps to reproduce Steps to reproduce the behavior:

  1. Go to https://stackblitz.com/edit/nuxthub-test-bug?file=nuxt.config.ts,vitest.config.ts
  2. Run pnpm test.
  3. Observe failure.
  4. Remove the @nuxthub/core module from nuxt.config.ts
  5. Observe success.

Expected behavior Tests should work the same regardless.

atinux commented 1 month ago

Hey @OhB00 and thanks for reporting

So far you need to set the dev: true when testing with NuxtHub as it uses Cloudflare bindings for production.

await setup({
  server: true,
  dev: true, // <-- required
});

Feel free to checkout our tests: https://github.com/nuxt-hub/core/tree/main/test