1
0
mirror of https://github.com/robonen/tools.git synced 2026-03-20 10:54:44 +00:00

chore: add workspace vitest configuration for testing with jsdom and coverage

This commit is contained in:
2025-05-19 04:34:13 +07:00
parent c5f34efe05
commit fa726eecc4
8 changed files with 110 additions and 1201 deletions

View File

@@ -69,14 +69,11 @@ const generatePackageJson = async (name: string, path: string, hasVite: boolean)
}, },
type: 'module', type: 'module',
files: ['dist'], files: ['dist'],
main: './dist/index.umd.js',
module: './dist/index.js',
types: './dist/index.d.ts',
exports: { exports: {
'.': { '.': {
types: './dist/index.d.ts',
import: './dist/index.js', import: './dist/index.js',
require: './dist/index.umd.js', require: './dist/index.umd.js',
types: './dist/index.d.ts',
}, },
}, },
scripts: { scripts: {

View File

@@ -25,14 +25,14 @@
"citty": "^0.1.6", "citty": "^0.1.6",
"jiti": "^2.4.2", "jiti": "^2.4.2",
"scule": "^1.3.0", "scule": "^1.3.0",
"vitepress": "^1.6.3" "jsdom": "catalog:",
"vitest": "catalog:",
"@vitest/coverage-v8": "catalog:",
"@vitest/ui": "catalog:"
}, },
"scripts": { "scripts": {
"all:build": "pnpm -r build", "build": "pnpm -r build",
"all:test": "pnpm -r test", "test": "vitest",
"create": "jiti ./bin/cli.ts", "create": "jiti ./bin/cli.ts"
"docs:dev": "vitepress dev .",
"docs:build": "vitepress build .",
"docs:preview": "vitepress preview ."
} }
} }

View File

@@ -28,14 +28,14 @@
], ],
"exports": { "exports": {
"./browsers": { "./browsers": {
"types": "./dist/browsers.d.ts",
"import": "./dist/browsers.mjs", "import": "./dist/browsers.mjs",
"require": "./dist/browsers.cjs", "require": "./dist/browsers.cjs"
"types": "./dist/browsers.d.ts"
}, },
"./multi": { "./multi": {
"types": "./dist/multi.d.ts",
"import": "./dist/multi.mjs", "import": "./dist/multi.mjs",
"require": "./dist/multi.cjs", "require": "./dist/multi.cjs"
"types": "./dist/multi.d.ts"
} }
}, },
"scripts": { "scripts": {
@@ -45,8 +45,6 @@
}, },
"devDependencies": { "devDependencies": {
"@robonen/tsconfig": "workspace:*", "@robonen/tsconfig": "workspace:*",
"jsdom": "catalog:", "unbuild": "catalog:"
"unbuild": "catalog:",
"vitest": "catalog:"
} }
} }

View File

@@ -26,14 +26,11 @@
"files": [ "files": [
"dist" "dist"
], ],
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": { "exports": {
".": { ".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs", "import": "./dist/index.mjs",
"require": "./dist/index.cjs", "require": "./dist/index.cjs"
"types": "./dist/index.d.ts"
} }
}, },
"scripts": { "scripts": {
@@ -43,9 +40,7 @@
}, },
"devDependencies": { "devDependencies": {
"@robonen/tsconfig": "workspace:*", "@robonen/tsconfig": "workspace:*",
"@vitest/coverage-v8": "catalog:",
"pathe": "catalog:", "pathe": "catalog:",
"unbuild": "catalog:", "unbuild": "catalog:"
"vitest": "catalog:"
} }
} }

View File

@@ -24,14 +24,11 @@
"files": [ "files": [
"dist" "dist"
], ],
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": { "exports": {
".": { ".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs", "import": "./dist/index.mjs",
"require": "./dist/index.cjs", "require": "./dist/index.cjs"
"types": "./dist/index.d.ts"
} }
}, },
"scripts": { "scripts": {
@@ -44,9 +41,7 @@
"@robonen/stdlib": "workspace:*", "@robonen/stdlib": "workspace:*",
"@robonen/tsconfig": "workspace:*", "@robonen/tsconfig": "workspace:*",
"@vue/test-utils": "catalog:", "@vue/test-utils": "catalog:",
"jsdom": "catalog:", "unbuild": "catalog:"
"unbuild": "catalog:",
"vitest": "catalog:"
}, },
"dependencies": { "dependencies": {
"vue": "catalog:" "vue": "catalog:"

1238
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -8,4 +8,5 @@ catalog:
pathe: ^2.0.3 pathe: ^2.0.3
unbuild: 3.5.0 unbuild: 3.5.0
vitest: ^3.1.3 vitest: ^3.1.3
'@vitest/ui': ^3.1.3
vue: ^3.5.13 vue: ^3.5.13

19
vitest.config.ts Normal file
View File

@@ -0,0 +1,19 @@
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
workspace: [
{
extends: true,
test: {
environment: 'jsdom',
},
},
],
coverage: {
provider: 'v8',
include: ['packages/*'],
exclude: ['**/node_modules/**', '**/dist/**'],
},
},
});