From 16297d76145b433c03ad513044dd9f252881dfa0 Mon Sep 17 00:00:00 2001 From: m-tartari <37861893+m-tartari@users.noreply.github.com> Date: Sat, 20 Jan 2024 09:46:29 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20test:=20add=20vitest.setup.ts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vite.config.ts | 4 +++- vitest.setup.ts | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 vitest.setup.ts diff --git a/vite.config.ts b/vite.config.ts index 540a8eb..6f21d57 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -5,6 +5,8 @@ import react from '@vitejs/plugin-react-swc' export default defineConfig({ plugins: [react()], test: { - environment: 'jsdom' + globals: true, + environment: 'jsdom', + setupFiles: ['./vitest.setup.ts'] } }) diff --git a/vitest.setup.ts b/vitest.setup.ts new file mode 100644 index 0000000..8f2609b --- /dev/null +++ b/vitest.setup.ts @@ -0,0 +1,5 @@ +// jest-dom adds custom jest matchers for asserting on DOM nodes. +// allows you to do things like: +// expect(element).toHaveTextContent(/react/i) +// learn more: https://github.com/testing-library/jest-dom +import '@testing-library/jest-dom';