build: add Vitest

This commit is contained in:
Kirill Gavrilov 2025-01-21 20:46:37 +03:00
parent d5b42fbe6a
commit e209f83b51
2 changed files with 19 additions and 2 deletions

View file

@ -5,7 +5,8 @@
"scripts": {
"dev": "node scripts/dev.js",
"build": "tsc -noEmit -skipLibCheck && node scripts/esbuild.build.js production",
"test:eslint": "eslint --cache --cache-location out/.eslintcache"
"test:eslint": "eslint --cache --cache-location out/.eslintcache",
"test:unit": "vitest --coverage"
},
"keywords": [
"obsidian.md",
@ -18,6 +19,7 @@
"@eslint/js": "9.18.0",
"@stylistic/eslint-plugin": "2.13.0",
"@types/node": "22.10.7",
"@vitest/coverage-v8": "3.0.3",
"enquirer": "2.4.1",
"esbuild": "0.24.2",
"eslint": "9.18.0",
@ -26,7 +28,8 @@
"obsidian": "1.7.2",
"obsidian-utils": "0.10.2",
"typescript": "5.7.3",
"typescript-eslint": "8.21.0"
"typescript-eslint": "8.21.0",
"vitest": "3.0.3"
},
"packageManager": "pnpm@9.15.4"
}

14
vitest.config.ts Normal file
View file

@ -0,0 +1,14 @@
import { defineConfig } from 'vitest/config'
export default defineConfig({
test: {
coverage: {
provider: 'v8',
reporter: ['lcov', 'html'],
reportsDirectory: 'out/coverage',
include: ['src/**/*.ts'],
},
reporters: ['default', 'junit'],
outputFile: 'out/unit-tests-results.xml',
},
})