mirror of
https://github.com/netajam/obsidian_note_uid_generator.git
synced 2026-07-22 05:45:32 +00:00
Sets up Vitest with an aliased obsidian stub so tests can load production modules without the real Electron-bound API, and a fake-app builder (in-memory vault, frontmatter, processFrontMatter) for testing commands that touch the Obsidian app object. Coverage: - uidUtils: generator selection (UUID/NanoID/ULID), NanoID separator injection, collision retry, getUIDFromFile/setUID/removeUID across edge cases (custom uidKey, legacy key cleanup, error paths). - commands: settings-driven decisions (autoGenerateUid toggle, scope=vault vs folder, exclusions including multi-entry / whitespace / blank / trailing-slash variants), bulk vs per-file parity, copy/clear flows, and degenerate "everything excluded" combinations. Includes one intentionally failing it() at commands.test.ts:225 that documents the inconsistency between handleClearUIDsInFolder (treats "/" as the whole vault) and the exclusion matcher (treats "/" as inert). The build's tsc step now excludes tests/ and *.test.ts; Vitest type-checks test code via esbuild at run time. Run with: npm test (or npm run test:watch).
36 lines
714 B
JSON
36 lines
714 B
JSON
{
|
|
"compilerOptions": {
|
|
"baseUrl": ".",
|
|
"inlineSourceMap": true,
|
|
"inlineSources": true,
|
|
"module": "ESNext",
|
|
"target": "ES6",
|
|
"allowJs": true,
|
|
"noImplicitAny": true,
|
|
"moduleResolution": "node",
|
|
"importHelpers": true,
|
|
"isolatedModules": true,
|
|
"strictNullChecks": true,
|
|
"lib": [
|
|
"DOM",
|
|
"ES5",
|
|
"ES6",
|
|
"ES7"
|
|
]
|
|
},
|
|
"typeRoots": [
|
|
"./node_modules/@types", // Standard location for installed types
|
|
"./src/typings" // Your custom typings folder
|
|
],
|
|
"include": [
|
|
"**/*.ts","**/*.d.ts", "src/typings/obsidian.d.ts"
|
|
|
|
|
|
],
|
|
"exclude": [
|
|
"node_modules",
|
|
"tests",
|
|
"src/**/*.test.ts",
|
|
"vitest.config.ts"
|
|
]
|
|
}
|