From 4f81564c49c4eb150763425115a510908f05b291 Mon Sep 17 00:00:00 2001 From: Ajax Davis Date: Tue, 25 Nov 2025 22:22:35 +1000 Subject: [PATCH] fix: add testing-library/jest-dom matchers for UI tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add @testing-library/jest-dom as dev dependency - Create test-setup.ts to import jest-dom matchers - Configure Vitest to use setup file - All UI package tests now passing Fixes test failures with toHaveTextContent and other DOM matchers. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- packages/ui/package.json | 3 ++- packages/ui/src/test-setup.ts | 1 + packages/ui/vitest.config.ts | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 packages/ui/src/test-setup.ts diff --git a/packages/ui/package.json b/packages/ui/package.json index 1fd045b..24380e0 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -32,10 +32,11 @@ "@tpmjs/utils": "workspace:*" }, "devDependencies": { + "@testing-library/jest-dom": "^6.9.1", + "@testing-library/react": "^16.3.0", "@tpmjs/eslint-config": "workspace:*", "@tpmjs/test": "workspace:*", "@tpmjs/tsconfig": "workspace:*", - "@testing-library/react": "^16.3.0", "@types/react": "^19.0.2", "@types/react-dom": "^19.0.2", "happy-dom": "^15.11.7", diff --git a/packages/ui/src/test-setup.ts b/packages/ui/src/test-setup.ts new file mode 100644 index 0000000..bb02c60 --- /dev/null +++ b/packages/ui/src/test-setup.ts @@ -0,0 +1 @@ +import '@testing-library/jest-dom/vitest'; diff --git a/packages/ui/vitest.config.ts b/packages/ui/vitest.config.ts index fe5b60f..266ee43 100644 --- a/packages/ui/vitest.config.ts +++ b/packages/ui/vitest.config.ts @@ -4,5 +4,6 @@ export default defineConfig({ test: { globals: true, environment: 'happy-dom', + setupFiles: ['./src/test-setup.ts'], }, });