obsidian-plugin-dev-kit 0.0.0-stage → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (329) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +223 -2
  3. package/bin/opdk.js +34 -0
  4. package/dist/build/args.d.ts +10 -0
  5. package/dist/build/args.js +45 -0
  6. package/dist/build/bundle-check.d.ts +17 -0
  7. package/dist/build/bundle-check.js +42 -0
  8. package/dist/build/bundle-file.d.ts +4 -0
  9. package/dist/build/bundle-file.js +29 -0
  10. package/dist/build/commands.d.ts +5 -0
  11. package/dist/build/commands.js +109 -0
  12. package/dist/build/config.d.ts +3 -0
  13. package/dist/build/config.js +103 -0
  14. package/dist/build/css-imports.d.ts +23 -0
  15. package/dist/build/css-imports.js +50 -0
  16. package/dist/build/css-step.d.ts +10 -0
  17. package/dist/build/css-step.js +27 -0
  18. package/dist/build/css.d.ts +24 -0
  19. package/dist/build/css.js +47 -0
  20. package/dist/build/options.d.ts +55 -0
  21. package/dist/build/options.js +70 -0
  22. package/dist/build/release.d.ts +5 -0
  23. package/dist/build/release.js +34 -0
  24. package/dist/build/report.d.ts +7 -0
  25. package/dist/build/report.js +16 -0
  26. package/dist/build/vault.d.ts +26 -0
  27. package/dist/build/vault.js +290 -0
  28. package/dist/build-info.json +1 -0
  29. package/dist/cli/argv.d.ts +14 -0
  30. package/dist/cli/argv.js +18 -0
  31. package/dist/cli/commands.d.ts +3 -0
  32. package/dist/cli/commands.js +7 -0
  33. package/dist/cli/main.d.ts +2 -0
  34. package/dist/cli/main.js +23 -0
  35. package/dist/cli/process-reporter.d.ts +5 -0
  36. package/dist/cli/process-reporter.js +15 -0
  37. package/dist/cli/registry.d.ts +4 -0
  38. package/dist/cli/registry.js +15 -0
  39. package/dist/cli/reporter.d.ts +53 -0
  40. package/dist/cli/reporter.js +100 -0
  41. package/dist/cli/run.d.ts +9 -0
  42. package/dist/cli/run.js +61 -0
  43. package/dist/cli/types.d.ts +27 -0
  44. package/dist/cli/types.js +1 -0
  45. package/dist/cli/version.d.ts +13 -0
  46. package/dist/cli/version.js +61 -0
  47. package/dist/config/define-config.d.ts +3 -0
  48. package/dist/config/define-config.js +4 -0
  49. package/dist/config/load-config.d.ts +6 -0
  50. package/dist/config/load-config.js +70 -0
  51. package/dist/config/manifest.d.ts +3 -0
  52. package/dist/config/manifest.js +72 -0
  53. package/dist/config/types.d.ts +146 -0
  54. package/dist/config/types.js +23 -0
  55. package/dist/demo/args.d.ts +4 -0
  56. package/dist/demo/args.js +13 -0
  57. package/dist/demo/checks.d.ts +56 -0
  58. package/dist/demo/checks.js +124 -0
  59. package/dist/demo/commands.d.ts +3 -0
  60. package/dist/demo/commands.js +65 -0
  61. package/dist/demo/config.d.ts +57 -0
  62. package/dist/demo/config.js +337 -0
  63. package/dist/demo/ffmpeg-run.d.ts +18 -0
  64. package/dist/demo/ffmpeg-run.js +59 -0
  65. package/dist/demo/ffmpeg.d.ts +63 -0
  66. package/dist/demo/ffmpeg.js +111 -0
  67. package/dist/demo/films.d.ts +46 -0
  68. package/dist/demo/films.js +134 -0
  69. package/dist/demo/phone-layout.d.ts +38 -0
  70. package/dist/demo/phone-layout.js +98 -0
  71. package/dist/demo/phone-render.d.ts +28 -0
  72. package/dist/demo/phone-render.js +124 -0
  73. package/dist/demo/published.d.ts +16 -0
  74. package/dist/demo/published.js +72 -0
  75. package/dist/demo/run.d.ts +31 -0
  76. package/dist/demo/run.js +397 -0
  77. package/dist/demo/stills.d.ts +21 -0
  78. package/dist/demo/stills.js +62 -0
  79. package/dist/e2e/artifacts.d.ts +27 -0
  80. package/dist/e2e/artifacts.js +90 -0
  81. package/dist/e2e/cleanup.d.ts +54 -0
  82. package/dist/e2e/cleanup.js +109 -0
  83. package/dist/e2e/config.d.ts +9 -0
  84. package/dist/e2e/config.js +42 -0
  85. package/dist/e2e/create-test.d.ts +37 -0
  86. package/dist/e2e/create-test.js +109 -0
  87. package/dist/e2e/demo/clip.d.ts +21 -0
  88. package/dist/e2e/demo/clip.js +44 -0
  89. package/dist/e2e/demo/create-demo.d.ts +42 -0
  90. package/dist/e2e/demo/create-demo.js +439 -0
  91. package/dist/e2e/demo/manifest.d.ts +76 -0
  92. package/dist/e2e/demo/manifest.js +168 -0
  93. package/dist/e2e/demo/names.d.ts +18 -0
  94. package/dist/e2e/demo/names.js +44 -0
  95. package/dist/e2e/demo/options.d.ts +22 -0
  96. package/dist/e2e/demo/options.js +59 -0
  97. package/dist/e2e/demo/ownership.d.ts +27 -0
  98. package/dist/e2e/demo/ownership.js +65 -0
  99. package/dist/e2e/demo/page-scripts.d.ts +82 -0
  100. package/dist/e2e/demo/page-scripts.js +250 -0
  101. package/dist/e2e/demo/png.d.ts +8 -0
  102. package/dist/e2e/demo/png.js +23 -0
  103. package/dist/e2e/demo/presets.d.ts +43 -0
  104. package/dist/e2e/demo/presets.js +20 -0
  105. package/dist/e2e/demo/privacy.d.ts +18 -0
  106. package/dist/e2e/demo/privacy.js +30 -0
  107. package/dist/e2e/demo/still-options.d.ts +22 -0
  108. package/dist/e2e/demo/still-options.js +68 -0
  109. package/dist/e2e/demo/types.d.ts +184 -0
  110. package/dist/e2e/demo/types.js +1 -0
  111. package/dist/e2e/electron-binary.d.ts +15 -0
  112. package/dist/e2e/electron-binary.js +30 -0
  113. package/dist/e2e/fixtures.d.ts +62 -0
  114. package/dist/e2e/fixtures.js +68 -0
  115. package/dist/e2e/gate.d.ts +4 -0
  116. package/dist/e2e/gate.js +8 -0
  117. package/dist/e2e/global-setup.d.ts +11 -0
  118. package/dist/e2e/global-setup.js +17 -0
  119. package/dist/e2e/helpers/commands.d.ts +14 -0
  120. package/dist/e2e/helpers/commands.js +56 -0
  121. package/dist/e2e/helpers/create-helpers.d.ts +24 -0
  122. package/dist/e2e/helpers/create-helpers.js +582 -0
  123. package/dist/e2e/helpers/device-metrics.d.ts +21 -0
  124. package/dist/e2e/helpers/device-metrics.js +25 -0
  125. package/dist/e2e/helpers/ime.d.ts +13 -0
  126. package/dist/e2e/helpers/ime.js +19 -0
  127. package/dist/e2e/helpers/layout-page-scripts.d.ts +103 -0
  128. package/dist/e2e/helpers/layout-page-scripts.js +224 -0
  129. package/dist/e2e/helpers/layout.d.ts +83 -0
  130. package/dist/e2e/helpers/layout.js +148 -0
  131. package/dist/e2e/helpers/mobile.d.ts +31 -0
  132. package/dist/e2e/helpers/mobile.js +26 -0
  133. package/dist/e2e/helpers/page-scripts.d.ts +194 -0
  134. package/dist/e2e/helpers/page-scripts.js +467 -0
  135. package/dist/e2e/helpers/settings.d.ts +8 -0
  136. package/dist/e2e/helpers/settings.js +16 -0
  137. package/dist/e2e/helpers/settle.d.ts +28 -0
  138. package/dist/e2e/helpers/settle.js +33 -0
  139. package/dist/e2e/helpers/types.d.ts +193 -0
  140. package/dist/e2e/helpers/types.js +1 -0
  141. package/dist/e2e/helpers/view-mode.d.ts +23 -0
  142. package/dist/e2e/helpers/view-mode.js +35 -0
  143. package/dist/e2e/index.d.ts +14 -0
  144. package/dist/e2e/index.js +4 -0
  145. package/dist/e2e/internals.d.ts +155 -0
  146. package/dist/e2e/internals.js +8 -0
  147. package/dist/e2e/obsidian-path.d.ts +17 -0
  148. package/dist/e2e/obsidian-path.js +31 -0
  149. package/dist/e2e/options.d.ts +123 -0
  150. package/dist/e2e/options.js +244 -0
  151. package/dist/e2e/page-scripts.d.ts +45 -0
  152. package/dist/e2e/page-scripts.js +53 -0
  153. package/dist/e2e/peers.d.ts +9 -0
  154. package/dist/e2e/peers.js +19 -0
  155. package/dist/e2e/plugins.d.ts +32 -0
  156. package/dist/e2e/plugins.js +119 -0
  157. package/dist/e2e/process-tree.d.ts +33 -0
  158. package/dist/e2e/process-tree.js +133 -0
  159. package/dist/e2e/readiness.d.ts +23 -0
  160. package/dist/e2e/readiness.js +63 -0
  161. package/dist/e2e/seed.d.ts +34 -0
  162. package/dist/e2e/seed.js +122 -0
  163. package/dist/e2e/session.d.ts +71 -0
  164. package/dist/e2e/session.js +266 -0
  165. package/dist/e2e/vault.d.ts +52 -0
  166. package/dist/e2e/vault.js +146 -0
  167. package/dist/e2e/version.d.ts +25 -0
  168. package/dist/e2e/version.js +40 -0
  169. package/dist/eslint/index.d.ts +2 -0
  170. package/dist/eslint/index.js +1 -0
  171. package/dist/eslint/obsidian-plugin.d.ts +49 -0
  172. package/dist/eslint/obsidian-plugin.js +115 -0
  173. package/dist/index.d.ts +3 -0
  174. package/dist/index.js +1 -0
  175. package/dist/kit/args.d.ts +7 -0
  176. package/dist/kit/args.js +21 -0
  177. package/dist/kit/commands.d.ts +3 -0
  178. package/dist/kit/commands.js +52 -0
  179. package/dist/kit/files.d.ts +3 -0
  180. package/dist/kit/files.js +24 -0
  181. package/dist/kit/pins.d.ts +89 -0
  182. package/dist/kit/pins.js +178 -0
  183. package/dist/kit/remote.d.ts +13 -0
  184. package/dist/kit/remote.js +33 -0
  185. package/dist/kit/runners.d.ts +11 -0
  186. package/dist/kit/runners.js +53 -0
  187. package/dist/kit/terminal-text.d.ts +6 -0
  188. package/dist/kit/terminal-text.js +20 -0
  189. package/dist/kit/upgrade.d.ts +26 -0
  190. package/dist/kit/upgrade.js +162 -0
  191. package/dist/peers/resolve.d.ts +8 -0
  192. package/dist/peers/resolve.js +28 -0
  193. package/dist/peers/versions.d.ts +30 -0
  194. package/dist/peers/versions.js +32 -0
  195. package/dist/release/api-check.d.ts +27 -0
  196. package/dist/release/api-check.js +119 -0
  197. package/dist/release/args.d.ts +40 -0
  198. package/dist/release/args.js +120 -0
  199. package/dist/release/assets.d.ts +21 -0
  200. package/dist/release/assets.js +35 -0
  201. package/dist/release/build-check.d.ts +43 -0
  202. package/dist/release/build-check.js +184 -0
  203. package/dist/release/build-script.d.ts +12 -0
  204. package/dist/release/build-script.js +30 -0
  205. package/dist/release/build-tagged.d.ts +26 -0
  206. package/dist/release/build-tagged.js +52 -0
  207. package/dist/release/bump.d.ts +24 -0
  208. package/dist/release/bump.js +58 -0
  209. package/dist/release/changelog.d.ts +25 -0
  210. package/dist/release/changelog.js +148 -0
  211. package/dist/release/check.d.ts +38 -0
  212. package/dist/release/check.js +150 -0
  213. package/dist/release/commands.d.ts +3 -0
  214. package/dist/release/commands.js +154 -0
  215. package/dist/release/committed-tree.d.ts +63 -0
  216. package/dist/release/committed-tree.js +118 -0
  217. package/dist/release/config.d.ts +3 -0
  218. package/dist/release/config.js +28 -0
  219. package/dist/release/gh-access.d.ts +14 -0
  220. package/dist/release/gh-access.js +45 -0
  221. package/dist/release/gh.d.ts +10 -0
  222. package/dist/release/gh.js +33 -0
  223. package/dist/release/git.d.ts +49 -0
  224. package/dist/release/git.js +111 -0
  225. package/dist/release/interrupt.d.ts +30 -0
  226. package/dist/release/interrupt.js +60 -0
  227. package/dist/release/json.d.ts +33 -0
  228. package/dist/release/json.js +81 -0
  229. package/dist/release/kit-check.d.ts +8 -0
  230. package/dist/release/kit-check.js +51 -0
  231. package/dist/release/manifest-rules.d.ts +23 -0
  232. package/dist/release/manifest-rules.js +255 -0
  233. package/dist/release/preflight.d.ts +10 -0
  234. package/dist/release/preflight.js +65 -0
  235. package/dist/release/problems.d.ts +24 -0
  236. package/dist/release/problems.js +11 -0
  237. package/dist/release/project-files.d.ts +14 -0
  238. package/dist/release/project-files.js +16 -0
  239. package/dist/release/publish-command.d.ts +21 -0
  240. package/dist/release/publish-command.js +83 -0
  241. package/dist/release/publish-git.d.ts +37 -0
  242. package/dist/release/publish-git.js +108 -0
  243. package/dist/release/publish-state.d.ts +29 -0
  244. package/dist/release/publish-state.js +70 -0
  245. package/dist/release/publish-verify.d.ts +41 -0
  246. package/dist/release/publish-verify.js +112 -0
  247. package/dist/release/publish-wait.d.ts +25 -0
  248. package/dist/release/publish-wait.js +56 -0
  249. package/dist/release/publish.d.ts +35 -0
  250. package/dist/release/publish.js +181 -0
  251. package/dist/release/release-assets.d.ts +39 -0
  252. package/dist/release/release-assets.js +68 -0
  253. package/dist/release/release.d.ts +37 -0
  254. package/dist/release/release.js +179 -0
  255. package/dist/release/remote.d.ts +12 -0
  256. package/dist/release/remote.js +15 -0
  257. package/dist/release/reproducible.d.ts +16 -0
  258. package/dist/release/reproducible.js +34 -0
  259. package/dist/release/run-tests.d.ts +5 -0
  260. package/dist/release/run-tests.js +17 -0
  261. package/dist/release/semver.d.ts +8 -0
  262. package/dist/release/semver.js +60 -0
  263. package/dist/release/version-rules.d.ts +28 -0
  264. package/dist/release/version-rules.js +63 -0
  265. package/dist/release/versions-json.d.ts +15 -0
  266. package/dist/release/versions-json.js +88 -0
  267. package/dist/release/workflow-run.d.ts +44 -0
  268. package/dist/release/workflow-run.js +71 -0
  269. package/dist/scanner/code-checks.d.ts +41 -0
  270. package/dist/scanner/code-checks.js +82 -0
  271. package/dist/scanner/commands.d.ts +3 -0
  272. package/dist/scanner/commands.js +43 -0
  273. package/dist/scanner/config.d.ts +7 -0
  274. package/dist/scanner/config.js +25 -0
  275. package/dist/scanner/css-check.d.ts +26 -0
  276. package/dist/scanner/css-check.js +63 -0
  277. package/dist/scanner/eslint-nesting.d.ts +16 -0
  278. package/dist/scanner/eslint-nesting.js +45 -0
  279. package/dist/scanner/findings.d.ts +23 -0
  280. package/dist/scanner/findings.js +21 -0
  281. package/dist/scanner/git-files.d.ts +16 -0
  282. package/dist/scanner/git-files.js +73 -0
  283. package/dist/scanner/lint.d.ts +47 -0
  284. package/dist/scanner/lint.js +163 -0
  285. package/dist/scanner/meta-checks.d.ts +8 -0
  286. package/dist/scanner/meta-checks.js +22 -0
  287. package/dist/scanner/outside-project.d.ts +19 -0
  288. package/dist/scanner/outside-project.js +20 -0
  289. package/dist/scanner/run.d.ts +19 -0
  290. package/dist/scanner/run.js +78 -0
  291. package/dist/scanner/scanner-config.d.ts +114 -0
  292. package/dist/scanner/scanner-config.js +207 -0
  293. package/dist/scanner/typescript-gate.d.ts +30 -0
  294. package/dist/scanner/typescript-gate.js +73 -0
  295. package/dist/vitest/build-config.d.ts +17 -0
  296. package/dist/vitest/build-config.js +106 -0
  297. package/dist/vitest/define-unit-config.d.ts +27 -0
  298. package/dist/vitest/define-unit-config.js +45 -0
  299. package/dist/vitest/dom/elements.d.ts +87 -0
  300. package/dist/vitest/dom/elements.js +291 -0
  301. package/dist/vitest/dom/index.d.ts +1 -0
  302. package/dist/vitest/dom/index.js +1 -0
  303. package/dist/vitest/dom/install.d.ts +8 -0
  304. package/dist/vitest/dom/install.js +261 -0
  305. package/dist/vitest/dom/setup.d.ts +1 -0
  306. package/dist/vitest/dom/setup.js +3 -0
  307. package/dist/vitest/index.d.ts +3 -0
  308. package/dist/vitest/index.js +2 -0
  309. package/dist/vitest/options.d.ts +92 -0
  310. package/dist/vitest/options.js +136 -0
  311. package/dist/vitest/peers.d.ts +10 -0
  312. package/dist/vitest/peers.js +51 -0
  313. package/dist/vitest/workspace-root.d.ts +7 -0
  314. package/dist/vitest/workspace-root.js +39 -0
  315. package/docs/build.md +232 -0
  316. package/docs/ci.md +182 -0
  317. package/docs/demo.md +364 -0
  318. package/docs/e2e.md +563 -0
  319. package/docs/release.md +374 -0
  320. package/docs/scanner.md +204 -0
  321. package/docs/unit.md +291 -0
  322. package/package.json +100 -4
  323. package/plugins/opdk/skills/audit/SKILL.md +81 -0
  324. package/plugins/opdk/skills/build/SKILL.md +79 -0
  325. package/plugins/opdk/skills/demo/SKILL.md +102 -0
  326. package/plugins/opdk/skills/e2e/SKILL.md +132 -0
  327. package/plugins/opdk/skills/release/SKILL.md +84 -0
  328. package/plugins/opdk/skills/scanner/SKILL.md +60 -0
  329. package/plugins/opdk/skills/unit/SKILL.md +90 -0
@@ -0,0 +1,291 @@
1
+ function isListener(value) {
2
+ return typeof value === "function";
3
+ }
4
+ function normalize(info) {
5
+ return typeof info === "string" ? { cls: info } : (info ?? {});
6
+ }
7
+ /**
8
+ * `createEl()` of the app: a string is shorthand for `{ cls }`; `cls` (string or array), `text`, `attr` (a null value
9
+ * removes the attribute), `title`, `value` (input, select, option), `type` (input; a `<style>` gets it as an
10
+ * attribute), `placeholder` (input), `href` (a, link, base) are applied in that order; then the callback runs, then
11
+ * the element is inserted into `parent` (first, with `prepend`); then every `on*` function in the info is registered
12
+ * as an event listener (`addEventListener(key.substring(2), fn)`, the function itself, so `removeEventListener`
13
+ * with the same function removes it). The info is not mutated. The text and the attributes go through the
14
+ * installed `el.setText()` and `el.setAttrs()`, as in the app.
15
+ */
16
+ export function createElement(tag, info, callback) {
17
+ const el = document.createElement(tag);
18
+ const { cls, text, attr, title, value, type, placeholder, href, parent, prepend } = normalize(info);
19
+ if (cls)
20
+ el.className = Array.isArray(cls) ? cls.join(" ") : cls;
21
+ if (text)
22
+ el.setText(text);
23
+ if (attr)
24
+ el.setAttrs(attr);
25
+ if (title !== undefined)
26
+ el.title = title;
27
+ if (value !== undefined && (el instanceof HTMLInputElement || el instanceof HTMLSelectElement || el instanceof HTMLOptionElement)) {
28
+ el.value = value;
29
+ }
30
+ if (type && el instanceof HTMLInputElement)
31
+ el.type = type;
32
+ if (type && el instanceof HTMLStyleElement)
33
+ el.setAttribute("type", type);
34
+ if (placeholder && el instanceof HTMLInputElement)
35
+ el.placeholder = placeholder;
36
+ if (href && (el instanceof HTMLAnchorElement || el instanceof HTMLLinkElement || el instanceof HTMLBaseElement))
37
+ el.href = href;
38
+ callback?.(el);
39
+ if (parent) {
40
+ if (prepend)
41
+ parent.insertBefore(el, parent.firstChild);
42
+ else
43
+ parent.appendChild(el);
44
+ }
45
+ for (const [key, handler] of Object.entries(normalize(info))) {
46
+ if (key.startsWith("on") && isListener(handler))
47
+ el.addEventListener(key.substring(2), handler);
48
+ }
49
+ return el;
50
+ }
51
+ /**
52
+ * `Node#createEl`: the global `createEl` with `parent` set to the node. As in the app, `parent` is written into the
53
+ * info object the caller passed (a string becomes a new `{ cls }` object).
54
+ */
55
+ export function createChild(parent, tag, info, callback) {
56
+ const given = normalize(info);
57
+ given.parent = parent;
58
+ return createEl(tag, given, callback);
59
+ }
60
+ /** `createFragment()` of the app: a detached fragment, passed to the callback first. */
61
+ export function createFragment(callback) {
62
+ const fragment = document.createDocumentFragment();
63
+ callback?.(fragment);
64
+ return fragment;
65
+ }
66
+ /** `Element#setText`: a Node or fragment replaces the children, anything else is stringified into textContent. */
67
+ export function setText(el, value) {
68
+ if (value instanceof Node) {
69
+ el.empty();
70
+ el.appendChild(value);
71
+ return;
72
+ }
73
+ el.textContent = String(value);
74
+ }
75
+ /** `Element#setAttr`: null removes the attribute, anything else is stringified. */
76
+ export function setAttr(el, name, value) {
77
+ if (value === null)
78
+ el.removeAttribute(name);
79
+ else
80
+ el.setAttribute(name, String(value));
81
+ }
82
+ /** `Element#setAttrs`: `setAttr` for every own key. */
83
+ export function setAttrs(el, attrs) {
84
+ for (const [name, value] of Object.entries(attrs))
85
+ setAttr(el, name, value);
86
+ }
87
+ /** The app's `getText()`: the text content, as the DOM defines it for elements, documents and fragments. */
88
+ export function getText(el) {
89
+ return el.textContent;
90
+ }
91
+ /** `Element#toggleClass`: the value is truthy to add and falsy to remove, so `undefined` removes (as in the app). */
92
+ export function toggleClass(el, classes, value) {
93
+ const list = Array.isArray(classes) ? classes : [classes];
94
+ if (value)
95
+ el.addClasses(list);
96
+ else
97
+ el.removeClasses(list);
98
+ }
99
+ /**
100
+ * `HTMLElement#hide`: remember an inline display value in `data-display`, then set `display: none`. Does nothing
101
+ * when it is already hidden.
102
+ */
103
+ export function hide(el) {
104
+ const previous = el.style.display;
105
+ if (previous === "none")
106
+ return;
107
+ el.style.display = "none";
108
+ if (previous)
109
+ el.setAttribute("data-display", previous);
110
+ else
111
+ el.removeAttribute("data-display");
112
+ }
113
+ /** `HTMLElement#show`: undo `hide()`, restoring the remembered display value. Does nothing unless hidden. */
114
+ export function show(el) {
115
+ if (el.style.display !== "none")
116
+ return;
117
+ el.style.display = el.getAttribute("data-display") ?? "";
118
+ el.removeAttribute("data-display");
119
+ }
120
+ /**
121
+ * `HTMLElement#isShown`. The app returns `!!offsetParent`, which jsdom (no layout) always reports as null, so a
122
+ * literal port would say false for everything. This one is true for an element that is in the document and has
123
+ * no inline `display: none` on itself or an ancestor.
124
+ */
125
+ export function isShown(el) {
126
+ if (!el.isConnected)
127
+ return false;
128
+ for (let node = el; node; node = node.parentElement) {
129
+ if (node.style.display === "none")
130
+ return false;
131
+ }
132
+ return true;
133
+ }
134
+ /** `setCssStyles`: assign every own property to `style`. */
135
+ export function setCssStyles(el, styles) {
136
+ Object.assign(el.style, styles);
137
+ }
138
+ /** `setCssProps`: `style.setProperty` for every own key, so custom properties (`--x`) work. */
139
+ export function setCssProps(el, props) {
140
+ for (const [name, value] of Object.entries(props))
141
+ el.style.setProperty(name, value);
142
+ }
143
+ /**
144
+ * `Node#instanceOf`: the plain operator, then the same class looked up by name on the node's own window and on the
145
+ * window the app's code runs in. With the one jsdom window of a test the `constructorWin` lookup finds what the
146
+ * `win` lookup found, so only the first two steps are reachable (and tested); the third is kept for parity.
147
+ */
148
+ export function instanceOf(node, type) {
149
+ if (node instanceof type)
150
+ return true;
151
+ const lookup = (window) => {
152
+ const candidate = Reflect.get(window, type.name);
153
+ return typeof candidate === "function" && node instanceof candidate;
154
+ };
155
+ return lookup(node.win) || lookup(node.constructorWin);
156
+ }
157
+ const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
158
+ /**
159
+ * `createSvg()` of the app: an SVG element in the SVG namespace. A string is shorthand for `{ cls }`; `cls` (string
160
+ * or array) goes to `classList`, then `attr`, then the callback, then insertion into `parent` (first, with `prepend`).
161
+ * Unlike `createEl`, there is no `text`, `title` or `on*` handling.
162
+ */
163
+ export function createSvgElement(tag, info, callback) {
164
+ const el = document.createElementNS(SVG_NAMESPACE, tag);
165
+ const { cls, attr, parent, prepend } = typeof info === "string" ? { cls: info } : (info ?? {});
166
+ if (cls)
167
+ el.classList.add(...(Array.isArray(cls) ? cls : [cls]));
168
+ if (attr)
169
+ el.setAttrs(attr);
170
+ callback?.(el);
171
+ if (parent) {
172
+ if (prepend)
173
+ parent.insertBefore(el, parent.firstChild);
174
+ else
175
+ parent.appendChild(el);
176
+ }
177
+ return el;
178
+ }
179
+ /** `Node#createSvg`: the global `createSvg` with `parent` set to the node. As with `createChild`, `parent` is written into the info. */
180
+ export function createSvgChild(parent, tag, info, callback) {
181
+ const given = typeof info === "string" ? { cls: info } : (info ?? {});
182
+ given.parent = parent;
183
+ return createSvgElement(tag, given, callback);
184
+ }
185
+ /**
186
+ * `Node#setChildrenInPlace`: makes the children of `node` exactly `children`, in order, moving as little as possible.
187
+ * A child already in the right place is not touched (it keeps focus and state); a child not in the list is removed.
188
+ */
189
+ export function setChildrenInPlace(node, children) {
190
+ let current = node.firstChild;
191
+ const wanted = new Set(children);
192
+ for (const child of children) {
193
+ while (current && !wanted.has(current)) {
194
+ const stale = current;
195
+ current = current.nextSibling;
196
+ node.removeChild(stale);
197
+ }
198
+ if (child !== current)
199
+ node.insertBefore(child, current);
200
+ else
201
+ current = current.nextSibling;
202
+ }
203
+ while (current) {
204
+ const stale = current;
205
+ current = current.nextSibling;
206
+ node.removeChild(stale);
207
+ }
208
+ }
209
+ /**
210
+ * `Element#matchParent`: the element itself or its closest ancestor that matches `selector`, not looking above
211
+ * `lastParent` (which is itself checked), or null.
212
+ */
213
+ export function matchParent(el, selector, lastParent) {
214
+ for (let node = el; node; node = node.parentElement) {
215
+ if (node.matches(selector))
216
+ return node;
217
+ if (node === lastParent)
218
+ return null;
219
+ }
220
+ return null;
221
+ }
222
+ /**
223
+ * `Element#isActiveElement`: focused in its own document, and every frame up to the top window is focused in its
224
+ * parent document too, and that top window is the active one.
225
+ */
226
+ export function isActiveElement(el) {
227
+ for (let node = el;;) {
228
+ if (node.doc.activeElement !== node)
229
+ return false;
230
+ const frame = node.win.frameElement;
231
+ if (!frame)
232
+ return node.win === activeWindow;
233
+ node = frame;
234
+ }
235
+ }
236
+ /** The delegated listeners per target, so `off` finds the wrapper `on` registered. The app keeps them in `_EVENTS`. */
237
+ const delegations = new WeakMap();
238
+ /**
239
+ * `on(type, selector, listener, options)`: a listener on the target that runs when the event's target (or an
240
+ * ancestor, up to the target) matches `selector`; `listener` gets the event and the matching element.
241
+ */
242
+ export function onDelegated(target, type, selector, listener, options) {
243
+ let byType = delegations.get(target);
244
+ if (!byType) {
245
+ byType = new Map();
246
+ delegations.set(target, byType);
247
+ }
248
+ const list = byType.get(type) ?? [];
249
+ byType.set(type, list);
250
+ const callback = (event) => {
251
+ const origin = event.target;
252
+ if (origin instanceof Element) {
253
+ const match = origin.matchParent(selector, event.currentTarget instanceof Element ? event.currentTarget : undefined);
254
+ if (match)
255
+ listener.call(target, event, match);
256
+ }
257
+ };
258
+ list.push({ selector, listener, options, callback });
259
+ target.addEventListener(type, callback, options);
260
+ }
261
+ /** `off(type, selector, listener, options)`: removes what `onDelegated` registered for the same four arguments. */
262
+ export function offDelegated(target, type, selector, listener, options) {
263
+ const byType = delegations.get(target);
264
+ const list = byType?.get(type);
265
+ if (!byType || !list)
266
+ return;
267
+ byType.set(type, list.filter((entry) => {
268
+ if (entry.selector === selector && entry.listener === listener && entry.options === options) {
269
+ target.removeEventListener(type, entry.callback, options);
270
+ return false;
271
+ }
272
+ return true;
273
+ }));
274
+ }
275
+ /** `UIEvent#instanceOf`: the plain operator, then the same class by name on the window the event came from. */
276
+ export function eventInstanceOf(event, type) {
277
+ if (event instanceof type)
278
+ return true;
279
+ const view = event.view;
280
+ if (!view)
281
+ return false;
282
+ const candidate = Reflect.get(view, type.name);
283
+ return typeof candidate === "function" && candidate !== type && event instanceof candidate;
284
+ }
285
+ /** `addEventListeners`: `addEventListener(type, fn)` for every own key whose value is a function; other values are skipped. */
286
+ export function addEventListeners(el, listeners) {
287
+ for (const [type, listener] of Object.entries(listeners)) {
288
+ if (isListener(listener))
289
+ el.addEventListener(type, listener);
290
+ }
291
+ }
@@ -0,0 +1 @@
1
+ export { installObsidianDom, uninstallObsidianDom } from "./install.js";
@@ -0,0 +1 @@
1
+ export { installObsidianDom, uninstallObsidianDom } from "./install.js";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Installs Obsidian's DOM helpers (`createDiv`, `setText`, `addClass`, `activeDocument`, the global `createEl`, ...)
3
+ * on the current jsdom. The list and the behaviour follow the app's own implementation (see `elements.ts`).
4
+ * Calling it again is a no-op. Throws when there is no DOM: run the test file in the jsdom environment.
5
+ */
6
+ export declare function installObsidianDom(): void;
7
+ /** Puts back what `installObsidianDom()` replaced and removes what it added. Safe to call when nothing is installed. */
8
+ export declare function uninstallObsidianDom(): void;
@@ -0,0 +1,261 @@
1
+ import { addEventListeners, createChild, createSvgChild, createSvgElement, eventInstanceOf, isActiveElement, matchParent, offDelegated, onDelegated, setChildrenInPlace, createElement, createFragment, getText, hide, instanceOf, isShown, setAttr, setAttrs, setCssProps, setCssStyles, setText, show, toggleClass, } from "./elements.js";
2
+ /** What was there before the install, per object and key, so `uninstallObsidianDom()` can put it back. */
3
+ const originals = new Map();
4
+ /** The prototype the helpers were installed on; a different one means vitest handed out a new DOM. */
5
+ let installedOn;
6
+ function define(target, key, descriptor, onlyIfMissing = false) {
7
+ if (onlyIfMissing && key in target)
8
+ return;
9
+ let saved = originals.get(target);
10
+ if (!saved) {
11
+ saved = new Map();
12
+ originals.set(target, saved);
13
+ }
14
+ if (!saved.has(key))
15
+ saved.set(key, Object.getOwnPropertyDescriptor(target, key));
16
+ Object.defineProperty(target, key, { configurable: true, enumerable: false, ...descriptor });
17
+ }
18
+ function method(target, key, value, onlyIfMissing = false) {
19
+ define(target, key, { value, writable: true }, onlyIfMissing);
20
+ }
21
+ function getter(target, key, get) {
22
+ define(target, key, { get });
23
+ }
24
+ /**
25
+ * Installs Obsidian's DOM helpers (`createDiv`, `setText`, `addClass`, `activeDocument`, the global `createEl`, ...)
26
+ * on the current jsdom. The list and the behaviour follow the app's own implementation (see `elements.ts`).
27
+ * Calling it again is a no-op. Throws when there is no DOM: run the test file in the jsdom environment.
28
+ */
29
+ export function installObsidianDom() {
30
+ if (typeof document === "undefined" || typeof Node === "undefined") {
31
+ throw new Error("installObsidianDom() needs a DOM and this test runs in the node environment. " +
32
+ "Add `// @vitest-environment jsdom` to the top of the test file, or list the file in the `dom` option of defineUnitConfig().");
33
+ }
34
+ if (installedOn === Node.prototype)
35
+ return;
36
+ // Within one module instance there is one jsdom window, so Node.prototype never changes and `installedOn` is
37
+ // only unset by uninstall(), which has already emptied `originals`. The clear() is a guard for a Vitest that would
38
+ // reuse this module with a fresh DOM; it cannot be reached from a test.
39
+ originals.clear();
40
+ installedOn = Node.prototype;
41
+ // Node
42
+ const node = Node.prototype;
43
+ getter(node, "doc", function () {
44
+ return this.ownerDocument ?? document;
45
+ });
46
+ getter(node, "win", function () {
47
+ return this.doc.defaultView ?? window;
48
+ });
49
+ define(node, "constructorWin", { value: window, writable: true });
50
+ method(node, "empty", function () {
51
+ while (this.lastChild)
52
+ this.removeChild(this.lastChild);
53
+ });
54
+ method(node, "appendText", function (text) {
55
+ this.appendChild(document.createTextNode(text));
56
+ });
57
+ method(node, "instanceOf", function (type) {
58
+ return instanceOf(this, type);
59
+ });
60
+ method(node, "createEl", function (tag, info, cb) {
61
+ return createChild(this, tag, info, cb);
62
+ });
63
+ method(node, "detach", function () {
64
+ this.parentNode?.removeChild(this);
65
+ });
66
+ method(node, "insertAfter", function (child, reference) {
67
+ this.insertBefore(child, reference ? reference.nextSibling : this.firstChild);
68
+ return child;
69
+ });
70
+ method(node, "indexOf", function (child) {
71
+ return Array.prototype.indexOf.call(this.childNodes, child);
72
+ });
73
+ method(node, "setChildrenInPlace", function (children) {
74
+ setChildrenInPlace(this, children);
75
+ });
76
+ method(node, "createSvg", function (tag, info, cb) {
77
+ return createSvgChild(this, tag, info, cb);
78
+ });
79
+ // createDiv and createSpan go through this.createEl(), and the globals through the global createEl, as in the app.
80
+ method(node, "createDiv", function (info, cb) {
81
+ return this.createEl("div", info, cb);
82
+ });
83
+ method(node, "createSpan", function (info, cb) {
84
+ return this.createEl("span", info, cb);
85
+ });
86
+ // Element
87
+ const element = Element.prototype;
88
+ method(element, "setText", function (value) {
89
+ setText(this, value);
90
+ });
91
+ method(element, "getText", function () {
92
+ return getText(this);
93
+ });
94
+ method(element, "setAttr", function (name, value) {
95
+ setAttr(this, name, value);
96
+ });
97
+ method(element, "setAttrs", function (attrs) {
98
+ setAttrs(this, attrs);
99
+ });
100
+ method(element, "getAttr", function (name) {
101
+ return this.getAttribute(name);
102
+ });
103
+ method(element, "addClass", function (...classes) {
104
+ this.addClasses(classes);
105
+ });
106
+ method(element, "addClasses", function (classes) {
107
+ for (const cls of classes)
108
+ this.classList.add(cls);
109
+ });
110
+ method(element, "removeClass", function (...classes) {
111
+ this.removeClasses(classes);
112
+ });
113
+ method(element, "removeClasses", function (classes) {
114
+ for (const cls of classes)
115
+ this.classList.remove(cls);
116
+ });
117
+ method(element, "toggleClass", function (classes, value) {
118
+ toggleClass(this, classes, value);
119
+ });
120
+ method(element, "hasClass", function (cls) {
121
+ return this.classList.contains(cls);
122
+ });
123
+ method(element, "find", function (selector) {
124
+ return this.querySelector(selector);
125
+ });
126
+ method(element, "findAll", function (selector) {
127
+ return Array.from(this.querySelectorAll(selector));
128
+ });
129
+ method(element, "findAllSelf", function (selector) {
130
+ const found = Array.from(this.querySelectorAll(selector));
131
+ if (this.matches(selector))
132
+ found.unshift(this);
133
+ return found;
134
+ });
135
+ method(element, "matchParent", function (selector, lastParent) {
136
+ return matchParent(this, selector, lastParent);
137
+ });
138
+ method(element, "getCssPropertyValue", function (property, pseudoElement) {
139
+ return getComputedStyle(this, pseudoElement).getPropertyValue(property).trim();
140
+ });
141
+ method(element, "isActiveElement", function () {
142
+ return isActiveElement(this);
143
+ });
144
+ // jsdom has no layout engine and no scrollIntoView; browsers (and the app) have it, tests need a no-op.
145
+ method(element, "scrollIntoView", function () {
146
+ /* nothing to scroll without layout */
147
+ }, true);
148
+ // DocumentFragment: find and findAll only (it is a Node, so the create helpers come from there).
149
+ const fragment = DocumentFragment.prototype;
150
+ method(fragment, "find", function (selector) {
151
+ return this.querySelector(selector);
152
+ });
153
+ method(fragment, "findAll", function (selector) {
154
+ return Array.from(this.querySelectorAll(selector));
155
+ });
156
+ // HTMLElement
157
+ const html = HTMLElement.prototype;
158
+ method(html, "show", function () {
159
+ show(this);
160
+ }, true);
161
+ method(html, "hide", function () {
162
+ hide(this);
163
+ }, true);
164
+ method(html, "toggle", function (visible) {
165
+ if (visible)
166
+ this.show();
167
+ else
168
+ this.hide();
169
+ }, true);
170
+ method(html, "toggleVisibility", function (visible) {
171
+ this.style.visibility = visible ? "" : "hidden";
172
+ }, true);
173
+ method(html, "addEventListeners", function (listeners) {
174
+ addEventListeners(this, listeners);
175
+ });
176
+ method(html, "trigger", function (eventType) {
177
+ this.dispatchEvent(new Event(eventType, { bubbles: true, cancelable: false }));
178
+ });
179
+ // The app's scrollWidth minus padding. jsdom reports scrollWidth 0 (no layout), so this is 0 minus the padding.
180
+ getter(html, "innerWidth", function () {
181
+ const style = getComputedStyle(this);
182
+ return this.scrollWidth - (parseFloat(style.paddingLeft) || 0) - (parseFloat(style.paddingRight) || 0);
183
+ });
184
+ getter(html, "innerHeight", function () {
185
+ const style = getComputedStyle(this);
186
+ return this.scrollHeight - (parseFloat(style.paddingTop) || 0) - (parseFloat(style.paddingBottom) || 0);
187
+ });
188
+ method(html, "isShown", function () {
189
+ return isShown(this);
190
+ });
191
+ method(html, "setCssStyles", function (styles) {
192
+ setCssStyles(this, styles);
193
+ });
194
+ method(html, "setCssProps", function (props) {
195
+ setCssProps(this, props);
196
+ });
197
+ method(html, "onClickEvent", function (listener, options) {
198
+ this.addEventListener("click", listener, options);
199
+ this.addEventListener("auxclick", listener, options);
200
+ });
201
+ for (const target of [html, Document.prototype]) {
202
+ method(target, "on", function (type, selector, listener, options) {
203
+ onDelegated(this, type, selector, listener, options);
204
+ });
205
+ method(target, "off", function (type, selector, listener, options) {
206
+ offDelegated(this, type, selector, listener, options);
207
+ });
208
+ }
209
+ method(SVGElement.prototype, "setCssStyles", function (styles) {
210
+ setCssStyles(this, styles);
211
+ });
212
+ method(SVGElement.prototype, "setCssProps", function (props) {
213
+ setCssProps(this, props);
214
+ });
215
+ // UIEvent
216
+ const uiEvent = UIEvent.prototype;
217
+ getter(uiEvent, "targetNode", function () {
218
+ return this.target;
219
+ });
220
+ getter(uiEvent, "win", function () {
221
+ return this.view ?? window;
222
+ });
223
+ getter(uiEvent, "doc", function () {
224
+ return this.win.document;
225
+ });
226
+ method(uiEvent, "instanceOf", function (type) {
227
+ return eventInstanceOf(this, type);
228
+ });
229
+ // Globals the app puts on `window`. Here `window` is the global scope vitest builds from jsdom.
230
+ method(globalThis, "createEl", createElement);
231
+ method(globalThis, "createDiv", (info, cb) => createEl("div", info, cb));
232
+ method(globalThis, "createSpan", (info, cb) => createEl("span", info, cb));
233
+ method(globalThis, "createSvg", createSvgElement);
234
+ method(globalThis, "createFragment", createFragment);
235
+ method(globalThis, "fish", (selector) => document.querySelector(selector));
236
+ method(globalThis, "fishAll", (selector) => Array.from(document.querySelectorAll(selector)));
237
+ method(globalThis, "ready", (callback) => {
238
+ if (document.readyState !== "loading")
239
+ callback();
240
+ else
241
+ document.addEventListener("DOMContentLoaded", callback);
242
+ });
243
+ method(globalThis, "sleep", (ms) => new Promise((resolve) => void window.setTimeout(resolve, ms)));
244
+ method(globalThis, "nextFrame", () => new Promise((resolve) => void window.requestAnimationFrame(() => { resolve(); })));
245
+ // One window only, so the active window and document are the global ones.
246
+ define(globalThis, "activeWindow", { value: window, writable: true }, true);
247
+ define(globalThis, "activeDocument", { value: document, writable: true }, true);
248
+ }
249
+ /** Puts back what `installObsidianDom()` replaced and removes what it added. Safe to call when nothing is installed. */
250
+ export function uninstallObsidianDom() {
251
+ for (const [target, saved] of originals) {
252
+ for (const [key, original] of saved) {
253
+ if (original)
254
+ Object.defineProperty(target, key, original);
255
+ else
256
+ Reflect.deleteProperty(target, key);
257
+ }
258
+ }
259
+ originals.clear();
260
+ installedOn = undefined;
261
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { installObsidianDom } from "./install.js";
2
+ // The vitest setup file of the `dom` project: runs once per test file, before the tests.
3
+ installObsidianDom();
@@ -0,0 +1,3 @@
1
+ export { defineUnitConfig } from "./define-unit-config.js";
2
+ export { BASE_COVERAGE_EXCLUDE, DEFAULT_THRESHOLDS } from "./options.js";
3
+ export type { CoverageThresholds, ObsidianSplitOption, UnitConfigOptions, UnitCoverageOptions } from "./options.js";
@@ -0,0 +1,2 @@
1
+ export { defineUnitConfig } from "./define-unit-config.js";
2
+ export { BASE_COVERAGE_EXCLUDE, DEFAULT_THRESHOLDS } from "./options.js";
@@ -0,0 +1,92 @@
1
+ /** Coverage thresholds in percent. */
2
+ export interface CoverageThresholds {
3
+ readonly lines: number;
4
+ readonly functions: number;
5
+ readonly statements: number;
6
+ readonly branches: number;
7
+ }
8
+ /** What three plugins gate on today. A floor, not a goal. */
9
+ export declare const DEFAULT_THRESHOLDS: CoverageThresholds;
10
+ /** Always left out of coverage: the tests themselves, the test helpers and type declarations. */
11
+ export declare const BASE_COVERAGE_EXCLUDE: readonly string[];
12
+ /** The `obsidian` value that selects the obsidian-test-mocks package instead of a plugin stub. */
13
+ export declare const OBSIDIAN_TEST_MOCKS = "obsidian-test-mocks";
14
+ export interface UnitCoverageOptions {
15
+ /** Required. Globs of the files the gate counts, for example `["src/**\/*.ts"]`. Unlisted files escape the gate. */
16
+ readonly include: readonly string[];
17
+ /** Added to {@link BASE_COVERAGE_EXCLUDE}. */
18
+ readonly exclude?: readonly string[];
19
+ /** Raise individual thresholds. A value below the default needs `allowLowerThresholds: true`. */
20
+ readonly thresholds?: Partial<CoverageThresholds>;
21
+ /** Lets `thresholds` go below {@link DEFAULT_THRESHOLDS}. Without it a lower value is an error. */
22
+ readonly allowLowerThresholds?: boolean;
23
+ /** Reports written next to `text` and `json-summary`. */
24
+ readonly extraReporters?: readonly ("lcov" | "html")[];
25
+ }
26
+ /** The `{ node, dom }` form of the `obsidian` option. */
27
+ export interface ObsidianSplitOption {
28
+ /** Stub path for the test files that run in node, relative to `rootDir`. */
29
+ readonly node: string;
30
+ /** `"obsidian-test-mocks"`, or a stub path relative to `rootDir`, for the test files that run in jsdom. */
31
+ readonly dom: string;
32
+ }
33
+ export interface UnitConfigOptions {
34
+ /** Required. See {@link UnitCoverageOptions}. */
35
+ readonly coverage: UnitCoverageOptions;
36
+ /**
37
+ * How `import "obsidian"` resolves in tests: a path to the plugin's own stub, relative to `rootDir`, or
38
+ * `"obsidian-test-mocks"` (the package's `vitest-setup` mocks the module and installs the DOM helpers; the
39
+ * package must be a dependency of the plugin, and it needs `dom`). An object `{ node, dom }` picks one per
40
+ * project: `node` is a stub path for the node tests, `dom` is `"obsidian-test-mocks"` or a stub path for the
41
+ * DOM tests (with `dom: "all"` there is no node project and `node` is not used). Omitted: no alias.
42
+ */
43
+ readonly obsidian?: string | ObsidianSplitOption;
44
+ /**
45
+ * Test files that need a DOM, as globs relative to the Vitest root (the folder of `vitest.config.ts`). They run
46
+ * in jsdom with Obsidian's DOM helpers installed; every other test file runs in node. `"all"` puts every test file in jsdom. Omitted or `[]`: all node.
47
+ */
48
+ readonly dom?: readonly string[] | "all";
49
+ /** Test file globs, relative to the Vitest root (the folder of `vitest.config.ts`). Default `["src/**\/*.test.ts"]`. */
50
+ readonly include?: readonly string[];
51
+ /** The folder the `obsidian` stub path is resolved against (nothing else uses it). Default `process.cwd()`; pass `import.meta.dirname`. */
52
+ readonly rootDir?: string;
53
+ }
54
+ export type ObsidianMode = {
55
+ readonly kind: "none";
56
+ } | {
57
+ readonly kind: "stub";
58
+ readonly path: string;
59
+ } | {
60
+ readonly kind: "mocks";
61
+ } | {
62
+ readonly kind: "split";
63
+ readonly node: string;
64
+ readonly dom: {
65
+ readonly kind: "mocks";
66
+ } | {
67
+ readonly kind: "stub";
68
+ readonly path: string;
69
+ };
70
+ };
71
+ export type DomMode = {
72
+ readonly kind: "none";
73
+ } | {
74
+ readonly kind: "all";
75
+ } | {
76
+ readonly kind: "split";
77
+ readonly globs: readonly string[];
78
+ };
79
+ export interface ResolvedUnitOptions {
80
+ readonly rootDir: string;
81
+ readonly include: readonly string[];
82
+ readonly obsidian: ObsidianMode;
83
+ readonly dom: DomMode;
84
+ readonly coverage: {
85
+ readonly include: readonly string[];
86
+ readonly exclude: readonly string[];
87
+ readonly thresholds: CoverageThresholds;
88
+ readonly reporters: readonly string[];
89
+ };
90
+ }
91
+ /** Applies the defaults and rejects values of the wrong type, naming the option and what to do. */
92
+ export declare function resolveUnitOptions(options: UnitConfigOptions, cwd: string): ResolvedUnitOptions;