Files
obsidian-livesync/vitest.config.unit.ts
T

46 lines
1.7 KiB
TypeScript
Raw Normal View History

2026-06-12 11:33:07 +01:00
/**
* @file vitest.config.unit.ts
* @description Configuration for running unit tests in Node.js (excluding browser harnesses, E2E, and database integration tests).
* This is executed during local development via `npm run test:unit` (or with coverage via `npm run test:unit:coverage`), and automatically in the GitHub Actions `unit-ci` workflow.
*/
2026-01-23 05:45:53 +00:00
import { defineConfig, mergeConfig } from "vitest/config";
import viteConfig from "./vitest.config.common";
2026-02-27 11:00:30 +00:00
const importOnlyFiles = ["**/encryption/encryptHKDF.ts"];
2026-01-23 05:45:53 +00:00
export default mergeConfig(
viteConfig,
defineConfig({
2026-02-27 11:00:30 +00:00
resolve: {
alias: {
obsidian: "", // prevent accidental imports of obsidian types in unit tests,
},
},
2026-01-23 05:45:53 +00:00
test: {
2026-06-02 12:34:46 +01:00
logHeapUsage: true,
// maxConcurrency: 2,
2026-01-23 05:45:53 +00:00
name: "unit-tests",
2026-02-25 09:38:31 +00:00
include: ["**/*unit.test.ts", "**/*.unit.spec.ts"],
2026-06-03 06:58:19 +01:00
exclude: ["test/**", "src/apps/**/testdeno/**"],
2026-01-23 05:45:53 +00:00
coverage: {
include: ["src/**/*.ts"],
2026-02-27 11:00:30 +00:00
exclude: [
"**/*.test.ts",
2026-06-02 12:34:46 +01:00
"**/*unit.test.ts",
"**/*.unit.spec.ts",
"test/**",
2026-02-27 11:00:30 +00:00
"src/lib/**/*.test.ts",
"**/_*",
2026-06-03 06:58:19 +01:00
"src/apps/**/testdeno/**",
// "src/apps/**",
2026-06-02 12:34:46 +01:00
// "src/cli/**",
"src/lib/src/cli/**",
2026-02-27 11:00:30 +00:00
"**/*_obsolete.ts",
...importOnlyFiles,
],
2026-01-23 05:45:53 +00:00
provider: "v8",
2026-03-03 13:22:17 +00:00
reporter: ["text", "json", "html", ["text", { file: "coverage-text.txt" }]],
2026-01-23 05:45:53 +00:00
},
},
})
);