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).
32 lines
858 B
JSON
32 lines
858 B
JSON
{
|
|
"name": "note_uid_generator",
|
|
"version": "1.2.1",
|
|
"description": "Obsidian plugin to generate unique IDs (UUID, NanoID, or ULID) for your notes",
|
|
"main": "src/main.js",
|
|
"scripts": {
|
|
"dev": "node esbuild.config.mjs",
|
|
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production",
|
|
"test": "vitest run",
|
|
"test:watch": "vitest",
|
|
"version": "node version-bump.mjs && git add manifest.json versions.json"
|
|
},
|
|
"keywords": [],
|
|
"author": "",
|
|
"license": "MIT",
|
|
"devDependencies": {
|
|
"@types/node": "^16.11.6",
|
|
"@typescript-eslint/eslint-plugin": "5.29.0",
|
|
"@typescript-eslint/parser": "5.29.0",
|
|
"builtin-modules": "3.3.0",
|
|
"esbuild": "^0.25.2",
|
|
"obsidian": "latest",
|
|
"tslib": "2.4.0",
|
|
"typescript": "4.7.4",
|
|
"vitest": "^1.6.1"
|
|
},
|
|
"dependencies": {
|
|
"nanoid": "^3.3.7",
|
|
"ulid": "^3.0.2",
|
|
"uuid": "^11.1.0"
|
|
}
|
|
}
|