From b9fca097460b692cf30d8b4d75d4b84af70d6468 Mon Sep 17 00:00:00 2001 From: Cosmo Hidalgo <44420648+nicehatharry@users.noreply.github.com> Date: Mon, 24 Jun 2024 15:43:04 -0500 Subject: [PATCH] import defineConfig from vitest/config The defineConfig function from vite is not type aware of the 'test' parameter. Importing defineConfig from 'vitest/config' fixes. --- blog/vitest-react-testing-library/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blog/vitest-react-testing-library/index.md b/blog/vitest-react-testing-library/index.md index 163751f..0656d2e 100644 --- a/blog/vitest-react-testing-library/index.md +++ b/blog/vitest-react-testing-library/index.md @@ -64,7 +64,7 @@ npm install jsdom --save-dev Second, include it to the Vite configuration file: ```javascript{7-9} -import { defineConfig } from 'vite'; +import { defineConfig } from 'vitest/config'; import react from '@vitejs/plugin-react'; // https://vitejs.dev/config/ @@ -99,7 +99,7 @@ afterEach(() => { And last, include this new test setup file in Vite's configuration file. In addition, make all imports from Vitest global, so that you don't need to perform these imports (e.g. `expect`) in each file manually anymore: ```javascript{8,10} -import { defineConfig } from 'vite'; +import { defineConfig } from 'vitest/config'; import react from '@vitejs/plugin-react'; // https://vitejs.dev/config/