Browse Source

init vitest workspace

main
谢亚昕 3 months ago
parent
commit
268e92c03f
  1. 2
      package.json
  2. 1
      packages/browser/package.json
  3. 11
      packages/browser/vitest.config.ts
  4. 4
      packages/core/vitest.config.ts
  5. 61
      pnpm-lock.yaml
  6. 9
      vitest.shared.ts
  7. 6
      vitest.workspace.ts

2
package.json

@ -12,6 +12,7 @@
"docs:build": "vitepress build packages",
"docs:serve": "vitepress serve packages",
"test": "vitest",
"test:ui": "vitest --ui",
"coverage": "vitest run --coverage"
},
"keywords": [],
@ -21,6 +22,7 @@
"@types/node": "^22.10.5",
"@vitepress-demo-preview/component": "^2.3.2",
"@vitepress-demo-preview/plugin": "^1.2.3",
"@vitest/ui": "^2.1.8",
"@vueuse/core": ">=10.0.0",
"fast-glob": "^3.3.3",
"fs-extra": "^11.2.0",

1
packages/browser/package.json

@ -1,6 +1,7 @@
{
"name": "@xyx-utils/browser",
"version": "1.0.0",
"type": "module",
"description": "",
"main": "dist/index.mjs",
"scripts": {

11
packages/browser/vitest.config.ts

@ -0,0 +1,11 @@
import { defineConfig, mergeConfig } from "vitest/config";
import VitestShared from "../../vitest.shared";
export default mergeConfig(
VitestShared,
defineConfig({
test: {
environment: "jsdom",
},
})
);

4
packages/core/vitest.config.ts

@ -0,0 +1,4 @@
import { defineConfig, mergeConfig } from "vitest/config";
import VitestShared from "../../vitest.shared";
export default mergeConfig(VitestShared, defineConfig({}));

61
pnpm-lock.yaml

@ -17,6 +17,9 @@ importers:
'@vitepress-demo-preview/plugin':
specifier: ^1.2.3
version: 1.2.3(markdown-it-container@3.0.0)(vitepress@1.5.0(@algolia/client-search@5.19.0)(@types/node@22.10.5)(async-validator@4.2.5)(postcss@8.4.49)(search-insights@2.17.3)(typescript@5.7.2))(vue@3.5.13(typescript@5.7.2))
'@vitest/ui':
specifier: ^2.1.8
version: 2.1.8(vitest@2.1.8)
'@vueuse/core':
specifier: '>=10.0.0'
version: 12.4.0(typescript@5.7.2)
@ -52,7 +55,7 @@ importers:
version: 1.5.0(@algolia/client-search@5.19.0)(@types/node@22.10.5)(async-validator@4.2.5)(postcss@8.4.49)(search-insights@2.17.3)(typescript@5.7.2)
vitest:
specifier: ^2.1.8
version: 2.1.8(@types/node@22.10.5)(jsdom@26.0.0)
version: 2.1.8(@types/node@22.10.5)(@vitest/ui@2.1.8)(jsdom@26.0.0)
vue:
specifier: ^3.5.13
version: 3.5.13(typescript@5.7.2)
@ -779,6 +782,9 @@ packages:
resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==}
engines: {node: '>= 8'}
'@polka/url@1.0.0-next.28':
resolution: {integrity: sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==}
'@rollup/plugin-alias@5.1.1':
resolution: {integrity: sha512-PR9zDb+rOzkRb2VD+EuKB7UC41vU5DIwZ5qqCpk0KJudcWAyi8rvYOhS7+L5aZCspw1stTViLgN5v6FF1p5cgQ==}
engines: {node: '>=14.0.0'}
@ -1060,6 +1066,11 @@ packages:
'@vitest/spy@2.1.8':
resolution: {integrity: sha512-5swjf2q95gXeYPevtW0BLk6H8+bPlMb4Vw/9Em4hFxDcaOxS+e0LOX4yqNxoHzMR2akEB2xfpnWUzkZokmgWDg==}
'@vitest/ui@2.1.8':
resolution: {integrity: sha512-5zPJ1fs0ixSVSs5+5V2XJjXLmNzjugHRyV11RqxYVR+oMcogZ9qTuSfKW+OcTV0JeFNznI83BNylzH6SSNJ1+w==}
peerDependencies:
vitest: 2.1.8
'@vitest/utils@2.1.8':
resolution: {integrity: sha512-dwSoui6djdwbfFmIgbIjX2ZhIoG7Ex/+xpxyiEgIGzjliY8xGkcpITKTlp6B4MgtGkF2ilvm97cPM96XZaAgcA==}
@ -1471,10 +1482,16 @@ packages:
picomatch:
optional: true
fflate@0.8.2:
resolution: {integrity: sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==}
fill-range@7.1.1:
resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==}
engines: {node: '>=8'}
flatted@3.3.2:
resolution: {integrity: sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==}
focus-trap@7.6.2:
resolution: {integrity: sha512-9FhUxK1hVju2+AiQIDJ5Dd//9R2n2RAfJ0qfhF4IHGHgcoEUTMpbTeG/zbEuwaiYXfuAH6XE0/aCyxDdRM+W5w==}
@ -1744,6 +1761,10 @@ packages:
mlly@1.7.3:
resolution: {integrity: sha512-xUsx5n/mN0uQf4V548PKQ+YShA4/IW0KI1dZhrNrPCLG+xizETbHTkOa1f8/xut9JRPp8kQuMnz0oqwkTiLo/A==}
mrmime@2.0.0:
resolution: {integrity: sha512-eu38+hdgojoyq63s+yTpN4XMBdt5l8HhMhc4VKLO9KM5caLIBvUm4thi7fFaxyTmCKeNnXZ5pAlBwCUnhA09uw==}
engines: {node: '>=10'}
ms@2.1.3:
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
@ -2080,6 +2101,10 @@ packages:
siginfo@2.0.0:
resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==}
sirv@3.0.0:
resolution: {integrity: sha512-BPwJGUeDaDCHihkORDchNyyTvWFhcusy1XMmhEVTQTwGeybFbp8YEmB+njbPnth1FibULBSBVwCQni25XlCUDg==}
engines: {node: '>=18'}
source-map-js@1.2.1:
resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==}
engines: {node: '>=0.10.0'}
@ -2165,6 +2190,10 @@ packages:
resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==}
engines: {node: '>=8.0'}
totalist@3.0.1:
resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==}
engines: {node: '>=6'}
tough-cookie@5.0.0:
resolution: {integrity: sha512-FRKsF7cz96xIIeMZ82ehjC3xW2E+O2+v11udrDYewUbszngYhsGa8z6YUMMzO9QJZzzyd0nGGXnML/TReX6W8Q==}
engines: {node: '>=16'}
@ -2937,6 +2966,8 @@ snapshots:
'@nodelib/fs.scandir': 2.1.5
fastq: 1.18.0
'@polka/url@1.0.0-next.28': {}
'@rollup/plugin-alias@5.1.1(rollup@4.29.2)':
optionalDependencies:
rollup: 4.29.2
@ -3179,6 +3210,17 @@ snapshots:
dependencies:
tinyspy: 3.0.2
'@vitest/ui@2.1.8(vitest@2.1.8)':
dependencies:
'@vitest/utils': 2.1.8
fflate: 0.8.2
flatted: 3.3.2
pathe: 1.1.2
sirv: 3.0.0
tinyglobby: 0.2.10
tinyrainbow: 1.2.0
vitest: 2.1.8(@types/node@22.10.5)(@vitest/ui@2.1.8)(jsdom@26.0.0)
'@vitest/utils@2.1.8':
dependencies:
'@vitest/pretty-format': 2.1.8
@ -3684,10 +3726,14 @@ snapshots:
optionalDependencies:
picomatch: 4.0.2
fflate@0.8.2: {}
fill-range@7.1.1:
dependencies:
to-regex-range: 5.0.1
flatted@3.3.2: {}
focus-trap@7.6.2:
dependencies:
tabbable: 6.2.0
@ -3975,6 +4021,8 @@ snapshots:
pkg-types: 1.3.0
ufo: 1.5.4
mrmime@2.0.0: {}
ms@2.1.3: {}
naive-ui@2.41.0(vue@3.5.13(typescript@5.7.2)):
@ -4320,6 +4368,12 @@ snapshots:
siginfo@2.0.0: {}
sirv@3.0.0:
dependencies:
'@polka/url': 1.0.0-next.28
mrmime: 2.0.0
totalist: 3.0.1
source-map-js@1.2.1: {}
space-separated-tokens@2.0.2: {}
@ -4390,6 +4444,8 @@ snapshots:
dependencies:
is-number: 7.0.0
totalist@3.0.1: {}
tough-cookie@5.0.0:
dependencies:
tldts: 6.1.71
@ -4589,7 +4645,7 @@ snapshots:
- typescript
- universal-cookie
vitest@2.1.8(@types/node@22.10.5)(jsdom@26.0.0):
vitest@2.1.8(@types/node@22.10.5)(@vitest/ui@2.1.8)(jsdom@26.0.0):
dependencies:
'@vitest/expect': 2.1.8
'@vitest/mocker': 2.1.8(vite@5.4.11(@types/node@22.10.5))
@ -4613,6 +4669,7 @@ snapshots:
why-is-node-running: 2.3.0
optionalDependencies:
'@types/node': 22.10.5
'@vitest/ui': 2.1.8(vitest@2.1.8)
jsdom: 26.0.0
transitivePeerDependencies:
- less

9
vitest.config.ts → vitest.shared.ts

@ -1,5 +1,5 @@
import { resolve } from "path";
import { configDefaults, defineConfig } from "vitest/config";
import { resolve } from "path";
const src = "src";
@ -14,11 +14,10 @@ export default defineConfig({
"xyx-utils": resolve(process.cwd(), "packages/xyx-utils/" + src),
},
globals: true,
environment: "jsdom",
exclude: [...configDefaults.exclude],
exclude: [...configDefaults.exclude, "packages/**/*.md"],
include: [
"packages/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}",
"packages/**/__tests__/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}",
"src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}",
"src/**/__tests__/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}",
],
},
});

6
vitest.workspace.ts

@ -0,0 +1,6 @@
import { defineWorkspace } from "vitest/config";
export default defineWorkspace([
"!packages/*.md",
"packages/*"
]);
Loading…
Cancel
Save