mirror of
https://bitbucket.org/Mattrixwv/mattrixwvreactcomponents.git
synced 2025-12-06 21:53:57 -05:00
Add test config
This commit is contained in:
@@ -24,7 +24,13 @@ export default defineConfig([
|
|||||||
ecmaVersion: 2022,
|
ecmaVersion: 2022,
|
||||||
globals: globals.browser,
|
globals: globals.browser,
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
project: ["./tsconfig.json", "./tsconfig.app.json", "./tsconfig.lib.json", "./tsconfig.node.json"],
|
project: [
|
||||||
|
"./tsconfig.json",
|
||||||
|
"./tsconfig.app.json",
|
||||||
|
"./tsconfig.lib.json",
|
||||||
|
"./tsconfig.node.json",
|
||||||
|
"./tsconfig.test.json"
|
||||||
|
],
|
||||||
tsconfigRootDir: import.meta.dirname
|
tsconfigRootDir: import.meta.dirname
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
1235
package-lock.json
generated
1235
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
11
package.json
11
package.json
@@ -7,6 +7,9 @@
|
|||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "eslint . && tsc -b && vite build",
|
"build": "eslint . && tsc -b && vite build",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
|
"test": "vitest run",
|
||||||
|
"test:watch": "vitest",
|
||||||
|
"coverage": "vitest run --coverage",
|
||||||
"check-git-clean": "git diff --quiet",
|
"check-git-clean": "git diff --quiet",
|
||||||
"deploy": "npm run check-git-clean && npm run build && npm pack && npm publish --access public",
|
"deploy": "npm run check-git-clean && npm run build && npm pack && npm publish --access public",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
@@ -29,6 +32,9 @@
|
|||||||
"@tanstack/react-router": "^1.136.1",
|
"@tanstack/react-router": "^1.136.1",
|
||||||
"@tanstack/react-router-devtools": "^1.136.1",
|
"@tanstack/react-router-devtools": "^1.136.1",
|
||||||
"@tanstack/router-plugin": "^1.136.1",
|
"@tanstack/router-plugin": "^1.136.1",
|
||||||
|
"@testing-library/jest-dom": "^6.9.1",
|
||||||
|
"@testing-library/react": "^16.3.0",
|
||||||
|
"@testing-library/user-event": "^14.6.1",
|
||||||
"@types/node": "^24.10.1",
|
"@types/node": "^24.10.1",
|
||||||
"@types/react": "^19.2.4",
|
"@types/react": "^19.2.4",
|
||||||
"@types/react-dom": "^19.2.3",
|
"@types/react-dom": "^19.2.3",
|
||||||
@@ -38,11 +44,14 @@
|
|||||||
"eslint-plugin-react-hooks": "^7.0.1",
|
"eslint-plugin-react-hooks": "^7.0.1",
|
||||||
"eslint-plugin-react-refresh": "^0.4.24",
|
"eslint-plugin-react-refresh": "^0.4.24",
|
||||||
"globals": "^16.5.0",
|
"globals": "^16.5.0",
|
||||||
|
"jsdom": "^27.2.0",
|
||||||
|
"rollup-plugin-jsx-remove-attributes": "^3.1.2",
|
||||||
"tailwindcss": "^4.1.17",
|
"tailwindcss": "^4.1.17",
|
||||||
"typescript": "^5.9.3",
|
"typescript": "^5.9.3",
|
||||||
"typescript-eslint": "^8.46.4",
|
"typescript-eslint": "^8.46.4",
|
||||||
"vite": "^7.2.2",
|
"vite": "^7.2.2",
|
||||||
"vite-plugin-dts": "^4.5.4"
|
"vite-plugin-dts": "^4.5.4",
|
||||||
|
"vitest": "^4.0.10"
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"@tailwindcss/vite": {
|
"@tailwindcss/vite": {
|
||||||
|
|||||||
1
test/jest.config.ts
Normal file
1
test/jest.config.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
import "@testing-library/jest-dom/vitest";
|
||||||
@@ -3,7 +3,8 @@
|
|||||||
"references": [
|
"references": [
|
||||||
{ "path": "./tsconfig.app.json" },
|
{ "path": "./tsconfig.app.json" },
|
||||||
{ "path": "./tsconfig.node.json" },
|
{ "path": "./tsconfig.node.json" },
|
||||||
{ "path": "./tsconfig.lib.json" }
|
{ "path": "./tsconfig.lib.json" },
|
||||||
|
{ "path": "./tsconfig.test.json" }
|
||||||
],
|
],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"jsx": "react-jsx"
|
"jsx": "react-jsx"
|
||||||
|
|||||||
@@ -22,5 +22,5 @@
|
|||||||
"noFallthroughCasesInSwitch": true,
|
"noFallthroughCasesInSwitch": true,
|
||||||
"noUncheckedSideEffectImports": true
|
"noUncheckedSideEffectImports": true
|
||||||
},
|
},
|
||||||
"include": ["vite.config.ts"]
|
"include": [ "eslint.config.ts", "vite.config.ts"]
|
||||||
}
|
}
|
||||||
|
|||||||
35
tsconfig.test.json
Normal file
35
tsconfig.test.json
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||||
|
"target": "ES2022",
|
||||||
|
"useDefineForClassFields": true,
|
||||||
|
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
||||||
|
"module": "ESNext",
|
||||||
|
"skipLibCheck": true,
|
||||||
|
|
||||||
|
/* Bundler mode */
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"verbatimModuleSyntax": true,
|
||||||
|
"moduleDetection": "force",
|
||||||
|
"noEmit": true,
|
||||||
|
"jsx": "react-jsx",
|
||||||
|
|
||||||
|
/* Linting */
|
||||||
|
"strict": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"erasableSyntaxOnly": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noUncheckedSideEffectImports": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"$/*": [ "./lib/*" ],
|
||||||
|
"#root": [ "." ]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"lib",
|
||||||
|
"test"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
|
/// <reference types="vitest/config" />
|
||||||
import tailwindcss from "@tailwindcss/vite";
|
import tailwindcss from "@tailwindcss/vite";
|
||||||
import { tanstackRouter } from "@tanstack/router-plugin/vite";
|
import { tanstackRouter } from "@tanstack/router-plugin/vite";
|
||||||
import react from "@vitejs/plugin-react";
|
import react from "@vitejs/plugin-react";
|
||||||
import { resolve } from "path";
|
import { resolve } from "path";
|
||||||
|
import removeTestIdAttribute from "rollup-plugin-jsx-remove-attributes";
|
||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
import dts from "vite-plugin-dts";
|
import dts from "vite-plugin-dts";
|
||||||
import { peerDependencies } from "./package.json";
|
import { peerDependencies } from "./package.json";
|
||||||
@@ -24,7 +26,8 @@ export default defineConfig({
|
|||||||
compilerOptions: {
|
compilerOptions: {
|
||||||
declarationMap: false
|
declarationMap: false
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
|
removeTestIdAttribute({ usage: "vite" })
|
||||||
],
|
],
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
@@ -55,5 +58,11 @@ export default defineConfig({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
publicDir: false
|
publicDir: false,
|
||||||
|
test: {
|
||||||
|
globals: true,
|
||||||
|
root: "test",
|
||||||
|
environment: "jsdom",
|
||||||
|
setupFiles: [ "jest.config.ts" ]
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user