From b7f0a046e30916545cc7bf62238f48285b6699c2 Mon Sep 17 00:00:00 2001 From: KatiaLiu Date: Wed, 25 Mar 2026 23:23:26 +0800 Subject: Add Vitest testing setup and Button component tests (#11) * Add Vitest testing setup and Button component tests - Install Vitest and related dependencies - Configure Vitest with React support - Create Button component test cases - Add test scripts to package.json - Create TESTING.md documentation - Update test comments to English for consistency * Update package.json Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Bertrand Yuan * Update package.json Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Bertrand Yuan * remove TESTING.md for the moment There are many parts not matched with current content. Signed-off-by: Bertrand Yuan --------- Signed-off-by: Bertrand Yuan Signed-off-by: Bertrand Yuan Co-authored-by: Bertrand Yuan Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Bertrand Yuan --- package.json | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'package.json') diff --git a/package.json b/package.json index a3bb1cb..d3155a3 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,10 @@ "payload:migrate:create": "payload migrate:create", "email:build": "email build", "email:dev": "email dev -p 3001", - "email:export": "email export" + "email:export": "email export", + "test": "vitest run", + "test:watch": "vitest watch", + "test:coverage": "vitest run --coverage" }, "dependencies": { "@fuma-comment/react": "^1.2.1", @@ -88,21 +91,28 @@ "devDependencies": { "@biomejs/biome": "1.9.4", "@tailwindcss/postcss": "4.1.18", + "@testing-library/dom": "^10.4.1", + "@testing-library/jest-dom": "^6.9.1", + "@testing-library/react": "^16.3.2", "@types/mdx": "2.0.13", "@types/node": "22.13.1", "@types/pg": "^8.16.0", "@types/react": "19.0.8", "@types/react-dom": "19.0.3", "@types/rss": "^0.0.32", + "@vitejs/plugin-react": "^4.2.1", "drizzle-kit": "^0.30.6", "fast-glob": "^3.3.3", "gray-matter": "^4.0.3", + "jsdom": "^20.0.0", "next-validate-link": "^1.5.2", "postcss": "8.5.1", "react-email": "^4.0.2", "tailwindcss": "4.1.18", "tsx": "^4.19.3", - "typescript": "5.7.3" + "typescript": "5.7.3", + "vitest": "^3.0.0", + "@vitest/coverage-v8": "^3.0.0" }, "ct3aMetadata": { "initVersion": "7.39.0" -- cgit v1.2.3