docs: update vitest config to match vitest docs (#3037)

* Update testing.md

in vite,
mergeConfig accepts only config in object form. If you have a config in callback form, you should call it before passing into mergeConfig.

You can use the defineConfig helper to merge a config in callback form with another config:

https://vite.dev/guide/api-javascript.html#mergeconfig

* Fix formatting

---------

Co-authored-by: Danilo Britto <dbritto.dev@gmail.com>
This commit is contained in:
Koo Sangmo 2025-03-03 21:46:37 +09:00 committed by GitHub
parent 979ce7de92
commit a90981afb5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -274,8 +274,9 @@ vi.mock('zustand') // to make it work like Jest (auto-mocking)
import { defineConfig, mergeConfig } from 'vitest/config'
import viteConfig from './vite.config'
export default mergeConfig(
viteConfig,
export default defineConfig((configEnv) =>
mergeConfig(
viteConfig(configEnv),
defineConfig({
test: {
globals: true,
@ -283,6 +284,7 @@ export default mergeConfig(
setupFiles: ['./setup-vitest.ts'],
},
}),
),
)
```