瀏覽代碼

feat: install vitest

Sv443 4 周之前
父節點
當前提交
9a7325225b
共有 3 個文件被更改,包括 560 次插入5 次删除
  1. 14 4
      package.json
  2. 538 1
      pnpm-lock.yaml
  3. 8 0
      vitest.config.ts

+ 14 - 4
package.json

@@ -14,6 +14,11 @@
       "import": "./dist/index.js"
     }
   },
+  "engines": {
+    "pnpm": ">=9",
+    "npm": "please-use-pnpm",
+    "yarn": "please-use-pnpm"
+  },
   "type": "module",
   "scripts": {
     "lint": "eslint . && tsc --noEmit",
@@ -29,9 +34,11 @@
     "publish-package-jsr": "pnpm update-jsr-version && npx jsr publish --allow-dirty",
     "check-jsr": "npx jsr publish --allow-dirty --dry-run",
     "change": "changeset",
-    "test-serve": "node --import tsx ./test/TestPage/server.mts",
-    "test-dev": "cd test/TestScript && pnpm dev",
-    "test": "concurrently \"pnpm test-serve\" \"pnpm test-dev\""
+    "test-gm-serve": "node --import tsx ./test/TestPage/server.mts",
+    "test-gm-dev": "cd test/TestScript && pnpm dev",
+    "test-gm": "concurrently \"pnpm test-gm-serve\" \"pnpm test-gm-dev\"",
+    "test": "vitest",
+    "test-dev": "vitest --watch"
   },
   "repository": {
     "type": "git",
@@ -56,6 +63,7 @@
   "devDependencies": {
     "@changesets/cli": "^2.27.11",
     "@eslint/eslintrc": "^3.2.0",
+    "@testing-library/dom": "^10.4.0",
     "@types/express": "^4.17.21",
     "@types/greasemonkey": "^4.0.7",
     "@types/node": "^22.10.5",
@@ -67,11 +75,13 @@
     "eslint": "^9.18.0",
     "express": "^4.21.2",
     "globals": "^15.14.0",
+    "jsdom": "^26.0.0",
     "kleur": "^4.1.5",
     "tslib": "^2.8.1",
     "tsup": "^8.3.5",
     "tsx": "^4.19.2",
-    "typescript": "^5.7.3"
+    "typescript": "^5.7.3",
+    "vitest": "^3.0.9"
   },
   "files": [
     "/dist/index.js",

File diff suppressed because it is too large
+ 538 - 1
pnpm-lock.yaml


+ 8 - 0
vitest.config.ts

@@ -0,0 +1,8 @@
+import { defineConfig } from "vitest/config";
+
+export default defineConfig({
+  test: {
+    include: ["lib/**/*.spec.ts"],
+    environment: "jsdom",
+  },
+});

Some files were not shown because too many files changed in this diff