From eba97cdc57b8c464830f2e50111c0a4f2d5fbf75 Mon Sep 17 00:00:00 2001 From: Adam Gall Date: Sat, 10 Feb 2024 15:01:54 -0500 Subject: [PATCH] Configure vitest to look for unit tests in "test" directory --- .eslintignore | 1 + package.json | 2 +- test/.empty | 0 tsconfig.json | 1 + vitest.config.ts | 9 +++++++++ 5 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 test/.empty create mode 100644 vitest.config.ts diff --git a/.eslintignore b/.eslintignore index 1e5227c5f1..9b75c33f74 100644 --- a/.eslintignore +++ b/.eslintignore @@ -3,3 +3,4 @@ node_modules src/assets/typechain-types /docker playwright.config.ts +vitest.config.ts diff --git a/package.json b/package.json index 3a4c660593..869e7d3939 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "build:windows": "for /F \"delims=\" %I in ('git rev-parse HEAD') do set \"NEXT_PUBLIC_GIT_HASH=%I\" && next build", "graphql:build": "graphclient build", "graphql:dev-server": "graphclient serve-dev", - "test": "npm run set:env & next test", + "test": "vitest --dir=test", "prepare": "husky install", "tests": "playwright test" }, diff --git a/test/.empty b/test/.empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tsconfig.json b/tsconfig.json index 325949a82f..ca09d9c784 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -32,6 +32,7 @@ "include": [ "src", "tests", + "test", "app", ".next/types/**/*.ts", "next-env.d.ts", diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 0000000000..8732721244 --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,9 @@ +import { defineConfig } from 'vitest/config' +import react from '@vitejs/plugin-react' + +export default defineConfig({ + plugins: [react()], + test: { + environment: 'jsdom', + }, +})