Skip to content

v2.0.0

Choose a tag to compare

@github-actions github-actions released this 09 Apr 12:00
· 27 commits to main since this release

   🚨 Breaking Changes

   📖 Migration Guide

Nitro options as second argument

Nitro v3 ships an official Vite plugin (nitro/vite) that claims the nitro key on Vite's UserConfig for server configuration. Since nitro-test-utils v1 used the same key for test runner configuration, this caused a TypeScript type collision when both packages were used together (#20).

defineConfig now accepts the Nitro test options as a second argument instead of a key on the Vite config. This eliminates the module augmentation entirely – no shared key, no collision, no risk of this happening again.

The update is a one-line change. Move the nitro config object from inside the first argument to the second:

 import { defineConfig } from 'nitro-test-utils/config'

-export default defineConfig({
-  nitro: {
-    global: true,
-  },
-})
+export default defineConfig({}, {
+  global: true,
+})

If you're using custom options, the same pattern applies:

-export default defineConfig({
-  nitro: {
-    global: {
-      rootDir: 'backend',
-      mode: 'production',
-    },
-    rerunOnSourceChanges: false,
-  },
-})
+export default defineConfig({}, {
+  global: {
+    rootDir: 'backend',
+    mode: 'production',
+  },
+  rerunOnSourceChanges: false,
+})
    View changes on GitHub