mirror of
https://github.com/multica-ai/multica.git
synced 2026-06-16 19:29:26 +02:00
chore: set up test infrastructure for shared packages
Add vitest configs to packages/core and packages/views. Test deps added to pnpm catalog for unified versioning. Web test deps migrated to catalog references. pnpm test now discovers all packages. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -69,15 +69,15 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/postcss": "catalog:",
|
||||
"@testing-library/jest-dom": "^6.9.1",
|
||||
"@testing-library/react": "^16.3.2",
|
||||
"@testing-library/user-event": "^14.6.1",
|
||||
"@testing-library/jest-dom": "catalog:",
|
||||
"@testing-library/react": "catalog:",
|
||||
"@testing-library/user-event": "catalog:",
|
||||
"@types/react": "catalog:",
|
||||
"@types/react-dom": "catalog:",
|
||||
"@vitejs/plugin-react": "^6.0.1",
|
||||
"jsdom": "^29.0.1",
|
||||
"@vitejs/plugin-react": "catalog:",
|
||||
"jsdom": "catalog:",
|
||||
"tailwindcss": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "^4.1.0"
|
||||
"vitest": "catalog:"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"typecheck": "tsc --noEmit",
|
||||
"lint": "eslint ."
|
||||
"lint": "eslint .",
|
||||
"test": "vitest run"
|
||||
},
|
||||
"exports": {
|
||||
".": "./index.ts",
|
||||
@@ -64,6 +65,7 @@
|
||||
"devDependencies": {
|
||||
"@multica/tsconfig": "workspace:*",
|
||||
"@types/react": "catalog:",
|
||||
"typescript": "catalog:"
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:"
|
||||
}
|
||||
}
|
||||
|
||||
9
packages/core/vitest.config.ts
Normal file
9
packages/core/vitest.config.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { defineConfig } from "vitest/config";
|
||||
|
||||
export default defineConfig({
|
||||
test: {
|
||||
globals: true,
|
||||
include: ["**/*.test.{ts,tsx}"],
|
||||
passWithNoTests: true,
|
||||
},
|
||||
});
|
||||
@@ -5,7 +5,8 @@
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"typecheck": "tsc --noEmit",
|
||||
"lint": "eslint ."
|
||||
"lint": "eslint .",
|
||||
"test": "vitest run"
|
||||
},
|
||||
"exports": {
|
||||
"./navigation": "./navigation/index.ts",
|
||||
@@ -78,8 +79,14 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@multica/tsconfig": "workspace:*",
|
||||
"@testing-library/jest-dom": "catalog:",
|
||||
"@testing-library/react": "catalog:",
|
||||
"@testing-library/user-event": "catalog:",
|
||||
"@types/react": "catalog:",
|
||||
"@types/react-dom": "catalog:",
|
||||
"typescript": "catalog:"
|
||||
"@vitejs/plugin-react": "catalog:",
|
||||
"jsdom": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:"
|
||||
}
|
||||
}
|
||||
|
||||
16
packages/views/test/setup.ts
Normal file
16
packages/views/test/setup.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import "@testing-library/jest-dom/vitest";
|
||||
|
||||
// jsdom doesn't provide ResizeObserver; stub it so components that rely on it
|
||||
// (e.g. input-otp) can render in tests.
|
||||
if (typeof globalThis.ResizeObserver === "undefined") {
|
||||
globalThis.ResizeObserver = class ResizeObserver {
|
||||
observe() {}
|
||||
unobserve() {}
|
||||
disconnect() {}
|
||||
} as unknown as typeof ResizeObserver;
|
||||
}
|
||||
|
||||
// jsdom doesn't implement elementFromPoint; input-otp uses it internally.
|
||||
if (typeof document.elementFromPoint !== "function") {
|
||||
document.elementFromPoint = () => null;
|
||||
}
|
||||
12
packages/views/vitest.config.ts
Normal file
12
packages/views/vitest.config.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { defineConfig } from "vitest/config";
|
||||
import react from "@vitejs/plugin-react";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
test: {
|
||||
environment: "jsdom",
|
||||
globals: true,
|
||||
setupFiles: ["./test/setup.ts"],
|
||||
include: ["**/*.test.{ts,tsx}"],
|
||||
},
|
||||
});
|
||||
51
pnpm-lock.yaml
generated
51
pnpm-lock.yaml
generated
@@ -12,15 +12,30 @@ catalogs:
|
||||
'@tanstack/react-query':
|
||||
specifier: ^5.96.2
|
||||
version: 5.96.2
|
||||
'@testing-library/jest-dom':
|
||||
specifier: ^6.9.1
|
||||
version: 6.9.1
|
||||
'@testing-library/react':
|
||||
specifier: ^16.3.2
|
||||
version: 16.3.2
|
||||
'@testing-library/user-event':
|
||||
specifier: ^14.6.1
|
||||
version: 14.6.1
|
||||
'@types/node':
|
||||
specifier: ^25.0.10
|
||||
version: 25.5.0
|
||||
'@vitejs/plugin-react':
|
||||
specifier: ^6.0.1
|
||||
version: 6.0.1
|
||||
class-variance-authority:
|
||||
specifier: ^0.7.1
|
||||
version: 0.7.1
|
||||
clsx:
|
||||
specifier: ^2.1.1
|
||||
version: 2.1.1
|
||||
jsdom:
|
||||
specifier: ^29.0.1
|
||||
version: 29.0.1
|
||||
lucide-react:
|
||||
specifier: ^1.0.1
|
||||
version: 1.0.1
|
||||
@@ -39,6 +54,9 @@ catalogs:
|
||||
typescript:
|
||||
specifier: ^5.9.3
|
||||
version: 5.9.3
|
||||
vitest:
|
||||
specifier: ^4.1.0
|
||||
version: 4.1.0
|
||||
zustand:
|
||||
specifier: ^5.0.0
|
||||
version: 5.0.12
|
||||
@@ -312,13 +330,13 @@ importers:
|
||||
specifier: 'catalog:'
|
||||
version: 4.2.2
|
||||
'@testing-library/jest-dom':
|
||||
specifier: ^6.9.1
|
||||
specifier: 'catalog:'
|
||||
version: 6.9.1
|
||||
'@testing-library/react':
|
||||
specifier: ^16.3.2
|
||||
specifier: 'catalog:'
|
||||
version: 16.3.2(@testing-library/dom@10.4.1)(@types/react-dom@19.2.3(@types/react@19.2.14))(@types/react@19.2.14)(react-dom@19.2.3(react@19.2.3))(react@19.2.3)
|
||||
'@testing-library/user-event':
|
||||
specifier: ^14.6.1
|
||||
specifier: 'catalog:'
|
||||
version: 14.6.1(@testing-library/dom@10.4.1)
|
||||
'@types/react':
|
||||
specifier: ^19.2.0
|
||||
@@ -327,10 +345,10 @@ importers:
|
||||
specifier: ^19.2.0
|
||||
version: 19.2.3(@types/react@19.2.14)
|
||||
'@vitejs/plugin-react':
|
||||
specifier: ^6.0.1
|
||||
specifier: 'catalog:'
|
||||
version: 6.0.1(vite@8.0.1(@types/node@25.5.0)(jiti@2.6.1))
|
||||
jsdom:
|
||||
specifier: ^29.0.1
|
||||
specifier: 'catalog:'
|
||||
version: 29.0.1(@noble/hashes@1.8.0)
|
||||
tailwindcss:
|
||||
specifier: 'catalog:'
|
||||
@@ -339,7 +357,7 @@ importers:
|
||||
specifier: 'catalog:'
|
||||
version: 5.9.3
|
||||
vitest:
|
||||
specifier: ^4.1.0
|
||||
specifier: 'catalog:'
|
||||
version: 4.1.0(@types/node@25.5.0)(jsdom@29.0.1(@noble/hashes@1.8.0))(msw@2.12.14(@types/node@25.5.0)(typescript@5.9.3))(vite@8.0.1(@types/node@25.5.0)(jiti@2.6.1))
|
||||
|
||||
packages/core:
|
||||
@@ -366,6 +384,9 @@ importers:
|
||||
typescript:
|
||||
specifier: 'catalog:'
|
||||
version: 5.9.3
|
||||
vitest:
|
||||
specifier: 'catalog:'
|
||||
version: 4.1.0(@types/node@25.5.0)(jsdom@29.0.1(@noble/hashes@1.8.0))(msw@2.12.14(@types/node@25.5.0)(typescript@5.9.3))(vite@8.0.1(@types/node@25.5.0)(jiti@2.6.1))
|
||||
|
||||
packages/eslint-config:
|
||||
dependencies:
|
||||
@@ -610,15 +631,33 @@ importers:
|
||||
'@multica/tsconfig':
|
||||
specifier: workspace:*
|
||||
version: link:../tsconfig
|
||||
'@testing-library/jest-dom':
|
||||
specifier: 'catalog:'
|
||||
version: 6.9.1
|
||||
'@testing-library/react':
|
||||
specifier: 'catalog:'
|
||||
version: 16.3.2(@testing-library/dom@10.4.1)(@types/react-dom@19.2.3(@types/react@19.2.14))(@types/react@19.2.14)(react-dom@19.2.3(react@19.2.3))(react@19.2.3)
|
||||
'@testing-library/user-event':
|
||||
specifier: 'catalog:'
|
||||
version: 14.6.1(@testing-library/dom@10.4.1)
|
||||
'@types/react':
|
||||
specifier: ^19.2.0
|
||||
version: 19.2.14
|
||||
'@types/react-dom':
|
||||
specifier: ^19.2.0
|
||||
version: 19.2.3(@types/react@19.2.14)
|
||||
'@vitejs/plugin-react':
|
||||
specifier: 'catalog:'
|
||||
version: 6.0.1(vite@8.0.1(@types/node@25.5.0)(jiti@2.6.1))
|
||||
jsdom:
|
||||
specifier: 'catalog:'
|
||||
version: 29.0.1(@noble/hashes@1.8.0)
|
||||
typescript:
|
||||
specifier: 'catalog:'
|
||||
version: 5.9.3
|
||||
vitest:
|
||||
specifier: 'catalog:'
|
||||
version: 4.1.0(@types/node@25.5.0)(jsdom@29.0.1(@noble/hashes@1.8.0))(msw@2.12.14(@types/node@25.5.0)(typescript@5.9.3))(vite@8.0.1(@types/node@25.5.0)(jiti@2.6.1))
|
||||
|
||||
packages:
|
||||
|
||||
|
||||
@@ -27,3 +27,11 @@ catalog:
|
||||
|
||||
# Icons
|
||||
lucide-react: "^1.0.1"
|
||||
|
||||
# Testing
|
||||
vitest: "^4.1.0"
|
||||
jsdom: "^29.0.1"
|
||||
"@vitejs/plugin-react": "^6.0.1"
|
||||
"@testing-library/react": "^16.3.2"
|
||||
"@testing-library/jest-dom": "^6.9.1"
|
||||
"@testing-library/user-event": "^14.6.1"
|
||||
|
||||
Reference in New Issue
Block a user