AI-native design editor. Open-source Figma alternative.
test(app): expand Tauri helper coverage
Danila Poyarkov0f9b69d051ea
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 185e409a4..c6c96838b 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -14,6 +14,7 @@- Add stroke dash/gap controls to the stroke inspector panel.- Bump AI SDK dependencies for improved DeepSeek reasoning mode and newer model support.- Add PDF export — vector PDF output via SVG→PDF conversion. Available in export panel, CLI (`--format pdf`), and MCP (`export_pdf` tool).+- Add font settings controls for local font access, fallback font predownloads, and downloaded font cache management.### Fixes@@ -38,6 +39,7 @@### Performance- Cache downloaded remote fonts in app-local storage so reopened documents can reuse them without repeated network fetches.+- Add Tauri API mock coverage for font loading, font cache, external links, document read/write, and save dialogs.- Add a curated fallback font manifest for CJK and Arabic font downloads.- Cache instance override resolution and lazily populate opened `.fig` pages to reduce load time for large community files.- Reduce zoom and overlay rendering work by separating scene rendering from rulers, selection, labels, and input overlays.diff --git a/src/app/automation/mcp/spawn.ts b/src/app/automation/mcp/spawn.tsindex c5c889f8a..e4ab31d78 100644--- a/src/app/automation/mcp/spawn.ts+++ b/src/app/automation/mcp/spawn.ts@@ -1,7 +1,8 @@import { promiseTimeout } from '@vueuse/core'import { decodeTauriStderr } from '@/app/shell/ui'-import { AUTOMATION_HTTP_PORT, IS_BROWSER } from '@open-pencil/core/constants'+import { isTauri } from '@/app/tauri/env'+import { AUTOMATION_HTTP_PORT } from '@open-pencil/core/constants'import { randomHex } from '@open-pencil/core/random'interface AutomationHealth {@@ -50,8 +51,7 @@ export async function getAutomationAuthToken(): Promise<string | null> {}export async function spawnMCPIfNeeded(): Promise<AutomationServerHandle | null> {- const isTauri = IS_BROWSER && '__TAURI_INTERNALS__' in window- if (import.meta.env.DEV || !isTauri) {+ if (import.meta.env.DEV || !isTauri()) {return DEV_AUTOMATION_AUTH_TOKEN? { disconnect: noop, authToken: DEV_AUTOMATION_AUTH_TOKEN }: nulldiff --git a/src/app/document/io/reload-source.ts b/src/app/document/io/reload-source.tsindex 45ed34ca0..0191d0438 100644--- a/src/app/document/io/reload-source.ts+++ b/src/app/document/io/reload-source.ts@@ -1,6 +1,7 @@-import { IS_TAURI } from '@/constants'import { readFigFile } from '@open-pencil/core/io/formats/fig'+import { isTauri } from '@/app/tauri/env'+export type ReloadSourceOptions = {documentName: stringfilePath: string | null@@ -12,7 +13,7 @@ export async function readReloadSource({filePath,fileHandle}: ReloadSourceOptions) {- if (filePath && IS_TAURI) {+ if (filePath && isTauri()) {const { readFile: tauriRead } = await import('@tauri-apps/plugin-fs')const bytes = await tauriRead(filePath)const blob = new Blob([bytes])diff --git a/src/app/document/io/write.ts b/src/app/document/io/write.tsindex 865493e3b..776623084 100644--- a/src/app/document/io/write.ts+++ b/src/app/document/io/write.ts@@ -1,7 +1,7 @@-import { IS_TAURI } from '@/constants'-import type { EditorState } from '@open-pencil/core/editor'+import { isTauri } from '@/app/tauri/env'+type WriteDocumentState = EditorStatetype DocumentWriterOptions = {@@ -23,7 +23,7 @@ export function createDocumentWriter({setLastWriteTime(Date.now())const filePath = getFilePath()const fileHandle = getFileHandle()- if (filePath && IS_TAURI) {+ if (filePath && isTauri()) {const { writeFile: tauriWrite } = await import('@tauri-apps/plugin-fs')await tauriWrite(filePath, data)setSavedVersion(state.sceneVersion)diff --git a/src/app/editor/fonts/index.ts b/src/app/editor/fonts/index.tsindex 6ab22ba65..1d59945c3 100644--- a/src/app/editor/fonts/index.ts+++ b/src/app/editor/fonts/index.ts@@ -1,4 +1,3 @@-import { IS_TAURI } from '@open-pencil/core/constants'import { fontManager, styleToWeight, type LocalFontAccessState } from '@open-pencil/core/text'import {@@ -6,15 +5,22 @@ import {createTauriDownloadedFontCache,downloadedFontCacheSummary as tauriDownloadedFontCacheSummary} from '@/app/editor/fonts/cache'+import { isTauri } from '@/app/tauri/env'if (typeof navigator !== 'undefined') {fontManager.setFallbackUserAgent(navigator.userAgent)}-if (IS_TAURI) {+let tauriFontCacheConfigured = false++function configureTauriFontCache() {+ if (tauriFontCacheConfigured || !isTauri()) return+ tauriFontCacheConfigured = truefontManager.setDownloadedFontCache(createTauriDownloadedFontCache())}+configureTauriFontCache()+interface TauriFontFamily {family: stringstyles: string[]@@ -38,28 +44,31 @@ async function getTauriFonts(): Promise<TauriFontFamily[]> {}export function preloadFonts(): void {- if (IS_TAURI) {+ configureTauriFontCache()+ if (isTauri()) {void getTauriFonts().then(registerFontFaces)}}export function localFontAccessState(): LocalFontAccessState {- return IS_TAURI ? 'granted' : fontManager.localAccessState()+ return isTauri() ? 'granted' : fontManager.localAccessState()}export async function requestLocalFontAccess(): Promise<string[]> {- if (IS_TAURI) return listFamilies()+ if (isTauri()) return listFamilies()await fontManager.requestLocalFontAccess()return fontManager.listFamilies()}export async function downloadedFontCacheSummary() {- if (!IS_TAURI) return { count: 0, byteLength: 0, updatedAt: null }+ configureTauriFontCache()+ if (!isTauri()) return { count: 0, byteLength: 0, updatedAt: null }return tauriDownloadedFontCacheSummary()}export async function clearDownloadedFontCache(): Promise<void> {- if (!IS_TAURI) return+ configureTauriFontCache()+ if (!isTauri()) returnawait clearTauriDownloadedFontCache()}@@ -76,7 +85,8 @@ function registerFontFaces(fonts: TauriFontFamily[]): void {}export async function listFamilies(): Promise<string[]> {- if (IS_TAURI) {+ configureTauriFontCache()+ if (isTauri()) {const fonts = await getTauriFonts()return fonts.map((f) => f.family)}@@ -84,14 +94,16 @@ export async function listFamilies(): Promise<string[]> {}export async function listFonts(): Promise<TauriFontFamily[]> {- if (IS_TAURI) {+ configureTauriFontCache()+ if (isTauri()) {return getTauriFonts()}return []}export async function loadFont(family: string, style = 'Regular'): Promise<ArrayBuffer | null> {- if (IS_TAURI) {+ configureTauriFontCache()+ if (isTauri()) {const cached = await fontManager.loadCachedFont(family, style)if (cached) return cacheddiff --git a/src/app/shell/ui.ts b/src/app/shell/ui.tsindex 5ec374f32..4d4f93ca7 100644--- a/src/app/shell/ui.ts+++ b/src/app/shell/ui.ts@@ -1,7 +1,7 @@import { useEventListener } from '@vueuse/core'import { ref } from 'vue'-import { IS_TAURI } from '@open-pencil/core/constants'+import { isTauri } from '@/app/tauri/env'export type ToastVariant = 'default' | 'warning' | 'error'@@ -83,7 +83,7 @@ export const toast = {}export async function openExternalLink(url: string) {- if (IS_TAURI) {+ if (isTauri()) {const { openUrl } = await import('@tauri-apps/plugin-opener')await openUrl(url)} else {diff --git a/src/app/tauri/env.ts b/src/app/tauri/env.tsnew file mode 100644index 000000000..c19147c58--- /dev/null+++ b/src/app/tauri/env.ts@@ -0,0 +1,3 @@+export function isTauri(): boolean {+ return 'window' in globalThis && '__TAURI_INTERNALS__' in globalThis.window+}diff --git a/src/components/FontSettingsPopover.vue b/src/components/FontSettingsPopover.vuenew file mode 100644index 000000000..7b6c54ef4--- /dev/null+++ b/src/components/FontSettingsPopover.vue@@ -0,0 +1,179 @@+<script setup lang="ts">+import { PopoverContent, PopoverPortal, PopoverRoot, PopoverTrigger } from 'reka-ui'+import { computed, onMounted, ref } from 'vue'++import {+ clearDownloadedFontCache,+ downloadedFontCacheSummary,+ localFontAccessState,+ predownloadFallbackFonts,+ requestLocalFontAccess+} from '@/app/editor/fonts'+import { usePopoverUI } from '@/components/ui/popover'++const cls = usePopoverUI({ content: 'isolate z-[51] w-72 p-3' })+const cacheCount = ref(0)+const cacheByteLength = ref(0)+const cacheUpdatedAt = ref<number | null>(null)+const accessState = ref(localFontAccessState())+const busyAction = ref<'access' | 'download' | 'clear' | 'refresh' | null>(null)+const status = ref('')++const cacheSize = computed(() => {+ if (cacheByteLength.value === 0) return '0 MB'+ return `${(cacheByteLength.value / 1024 / 1024).toFixed(1)} MB`+})++const cacheUpdatedLabel = computed(() => {+ if (cacheUpdatedAt.value === null) return 'Never'+ return new Date(cacheUpdatedAt.value).toLocaleDateString()+})++async function refreshSummary() {+ busyAction.value = busyAction.value ?? 'refresh'+ try {+ const summary = await downloadedFontCacheSummary()+ cacheCount.value = summary.count+ cacheByteLength.value = summary.byteLength+ cacheUpdatedAt.value = summary.updatedAt+ accessState.value = localFontAccessState()+ } finally {+ if (busyAction.value === 'refresh') busyAction.value = null+ }+}++async function requestAccess() {+ busyAction.value = 'access'+ status.value = ''+ try {+ await requestLocalFontAccess()+ accessState.value = localFontAccessState()+ status.value = 'Local font access enabled.'+ } catch {+ accessState.value = localFontAccessState()+ status.value = 'Local font access was not granted.'+ } finally {+ busyAction.value = null+ }+}++async function downloadFallbacks() {+ busyAction.value = 'download'+ status.value = ''+ try {+ await predownloadFallbackFonts()+ await refreshSummary()+ status.value = 'Fallback fonts downloaded.'+ } catch {+ status.value = 'Could not download fallback fonts.'+ } finally {+ busyAction.value = null+ }+}++async function clearCache() {+ busyAction.value = 'clear'+ status.value = ''+ try {+ await clearDownloadedFontCache()+ await refreshSummary()+ status.value = 'Downloaded font cache cleared.'+ } catch {+ status.value = 'Could not clear downloaded font cache.'+ } finally {+ busyAction.value = null+ }+}++onMounted(() => {+ void refreshSummary()+})+</script>++<template>+ <PopoverRoot @update:open="$event && refreshSummary()">+ <PopoverTrigger+ data-test-id="font-settings-trigger"+ class="flex size-7 shrink-0 cursor-pointer items-center justify-center rounded border border-border bg-input text-muted hover:bg-hover hover:text-surface"+ title="Font settings"+ >+ <icon-lucide-settings class="size-3.5" />+ </PopoverTrigger>++ <PopoverPortal>+ <PopoverContent+ side="left"+ :side-offset="8"+ align="start"+ :collision-padding="16"+ :avoid-collisions="true"+ :class="cls.content"+ >+ <div class="flex flex-col gap-3">+ <div>+ <h3 class="text-[11px] font-semibold text-surface">Fonts</h3>+ <p class="mt-1 text-[10px] leading-relaxed text-muted">+ Manage local font access and OpenPencil's downloaded fallback font cache.+ </p>+ </div>++ <div class="rounded border border-border bg-input/40 p-2 text-[10px] text-muted">+ <div class="flex justify-between gap-3">+ <span>Local access</span>+ <span class="text-surface">{{ accessState }}</span>+ </div>+ <div class="mt-1 flex justify-between gap-3">+ <span>Downloaded cache</span>+ <span class="text-surface">{{ cacheCount }} fonts · {{ cacheSize }}</span>+ </div>+ <div class="mt-1 flex justify-between gap-3">+ <span>Updated</span>+ <span class="text-surface">{{ cacheUpdatedLabel }}</span>+ </div>+ </div>++ <div class="grid grid-cols-2 gap-1.5">+ <button+ type="button"+ data-test-id="font-settings-request-access"+ class="rounded bg-input px-2 py-1.5 text-[10px] font-medium text-surface hover:bg-hover disabled:opacity-50"+ :disabled="busyAction !== null"+ @click="requestAccess"+ >+ {{ busyAction === 'access' ? 'Requesting…' : 'Local fonts' }}+ </button>+ <button+ type="button"+ data-test-id="font-settings-download-fallbacks"+ class="rounded bg-accent px-2 py-1.5 text-[10px] font-medium text-white hover:bg-accent/90 disabled:opacity-50"+ :disabled="busyAction !== null"+ @click="downloadFallbacks"+ >+ {{ busyAction === 'download' ? 'Downloading…' : 'Download fallbacks' }}+ </button>+ <button+ type="button"+ data-test-id="font-settings-refresh-cache"+ class="rounded bg-input px-2 py-1.5 text-[10px] font-medium text-surface hover:bg-hover disabled:opacity-50"+ :disabled="busyAction !== null"+ @click="refreshSummary"+ >+ Refresh+ </button>+ <button+ type="button"+ data-test-id="font-settings-clear-cache"+ class="rounded bg-input px-2 py-1.5 text-[10px] font-medium text-surface hover:bg-hover disabled:opacity-50"+ :disabled="busyAction !== null || cacheCount === 0"+ @click="clearCache"+ >+ Clear cache+ </button>+ </div>++ <p v-if="status" class="text-[10px] leading-relaxed text-muted">{{ status }}</p>+ </div>+ </PopoverContent>+ </PopoverPortal>+ </PopoverRoot>+</template>diff --git a/src/components/properties/TypographySection.vue b/src/components/properties/TypographySection.vueindex a81a70a30..733ea88c7 100644--- a/src/components/properties/TypographySection.vue+++ b/src/components/properties/TypographySection.vue@@ -4,6 +4,7 @@ import { ToggleGroupItem, ToggleGroupRoot } from 'reka-ui'import { TypographyControlsRoot, useI18n } from '@open-pencil/vue'import FontPicker from '@/components/FontPicker.vue'+import FontSettingsPopover from '@/components/FontSettingsPopover.vue'import ScrubInput from '@/components/ScrubInput.vue'import VariableScrubInput from '@/components/properties/VariableScrubInput.vue'import AppSelect from '@/components/ui/AppSelect.vue'@@ -27,6 +28,7 @@ const fontLoader = { load: loadFont }:model-value="ctx.node.value.fontFamily"@select="ctx.actions.setFamily"/>+ <FontSettingsPopover /><Tipv-if="ctx.hasMissingFonts.value":label="diff --git a/src/views/EditorView.vue b/src/views/EditorView.vueindex d7fc4def1..626b5108a 100644--- a/src/views/EditorView.vue+++ b/src/views/EditorView.vue@@ -12,7 +12,7 @@ import { useMenu } from '@/app/shell/menu/use'import { useCollab, COLLAB_KEY } from '@/app/collab/use'import { connectAutomation } from '@/app/automation/bridge/server'import { spawnMCPIfNeeded } from '@/app/automation/mcp/spawn'-import { IS_BROWSER } from '@open-pencil/core/constants'+import { isTauri } from '@/app/tauri/env'import { createDemoShapes } from '@/app/demo/document'import { useEditorStore } from '@/app/editor/active-store'import { createTab, activeTab, getActiveStore, tabCount } from '@/app/tabs'@@ -64,13 +64,13 @@ onMounted(async () => {try {const mcp = await spawnMCPIfNeeded()mcpCleanup.value = mcp?.disconnect ?? null- const isTauri = IS_BROWSER && '__TAURI_INTERNALS__' in window- if (import.meta.env.DEV || isTauri) {+ const tauri = isTauri()+ if (import.meta.env.DEV || tauri) {automationCleanup.value = connectAutomation(getActiveStore, mcp?.authToken ?? null).disconnect}} catch (e) {console.warn('[MCP]', e)- if (IS_BROWSER && '__TAURI_INTERNALS__' in window) {+ if (isTauri()) {const { toast } = await import('@/app/shell/ui')toast.warning('MCP server failed to start. Install with: npm i -g @open-pencil/mcp')}diff --git a/tests/engine/external-link.test.ts b/tests/engine/external-link.test.tsindex 7cee48754..1664dae9d 100644--- a/tests/engine/external-link.test.ts+++ b/tests/engine/external-link.test.ts@@ -1,6 +1,7 @@import { describe, test, expect, vi, beforeEach, afterEach } from 'bun:test'import { openExternalLink } from '@/app/shell/ui'+import { clearTauriMocks, mockTauriIPC } from '../helpers/tauri-mocks'/*** Tests for the browser (window.open) path only.@@ -15,7 +16,8 @@ describe('openExternalLink', () => {globalThis.window = { open: mockOpen } as unknown as Window & typeof globalThis})- afterEach(() => {+ afterEach(async () => {+ await clearTauriMocks()// @ts-expect-error test cleanupdelete globalThis.windowvi.restoreAllMocks()@@ -38,4 +40,16 @@ describe('openExternalLink', () => {expect(mockOpen).toHaveBeenCalledWith('https://example.com/docs', '_blank')})++ test('opens links through Tauri opener when running in Tauri', async () => {+ await mockTauriIPC((cmd, args) => {+ expect(cmd).toBe('plugin:opener|open_url')+ expect(args).toEqual({ url: 'https://example.com/docs', with: undefined })+ return null+ })++ await openExternalLink('https://example.com/docs')++ expect(mockOpen).not.toHaveBeenCalled()+ })})diff --git a/tests/engine/tauri-document-io.test.ts b/tests/engine/tauri-document-io.test.tsnew file mode 100644index 000000000..16c167f7d--- /dev/null+++ b/tests/engine/tauri-document-io.test.ts@@ -0,0 +1,72 @@+import { afterEach, describe, expect, test } from 'bun:test'++import { createDocumentWriter } from '@/app/document/io/write'+import { readReloadSource } from '@/app/document/io/reload-source'+import { chooseTauriFigSavePath } from '@/app/document/io/save-targets'+import { clearTauriMocks, mockTauriIPC } from '../helpers/tauri-mocks'++afterEach(async () => {+ await clearTauriMocks()+ // @ts-expect-error test cleanup+ delete globalThis.window+})++describe('Tauri document IO helpers', () => {+ test('reads reload source bytes through plugin-fs', async () => {+ const fixture = await Bun.file('tests/fixtures/gold-preview.fig').arrayBuffer()+ await mockTauriIPC((cmd, args) => {+ expect(cmd).toBe('plugin:fs|read_file')+ expect(args).toEqual({ path: '/tmp/document.fig', options: undefined })+ return [...new Uint8Array(fixture)]+ })++ const document = await readReloadSource({+ documentName: 'document',+ filePath: '/tmp/document.fig',+ fileHandle: null+ })++ expect(document?.getPages().length).toBeGreaterThan(0)+ })++ test('writes document bytes through plugin-fs', async () => {+ const calls: Array<{ cmd: string; args: unknown; options: unknown }> = []+ await mockTauriIPC((cmd, args, options) => {+ calls.push({ cmd, args, options })+ return null+ })+ const savedVersions: number[] = []+ const write = createDocumentWriter({+ state: { sceneVersion: 42 } as Parameters<typeof createDocumentWriter>[0]['state'],+ getFilePath: () => '/tmp/document.fig',+ getFileHandle: () => null,+ setSavedVersion: (version) => savedVersions.push(version),+ setLastWriteTime: () => {}+ })++ await write(new Uint8Array([1, 2, 3]))++ expect(calls).toHaveLength(1)+ expect(calls[0]?.cmd).toBe('plugin:fs|write_file')+ expect([...new Uint8Array(calls[0]?.args as ArrayBuffer)]).toEqual([1, 2, 3])+ expect(calls[0]?.options).toEqual({+ headers: { path: '%2Ftmp%2Fdocument.fig', options: undefined }+ })+ expect(savedVersions).toEqual([42])+ })++ test('chooses a Tauri save path through plugin-dialog', async () => {+ await mockTauriIPC((cmd, args) => {+ expect(cmd).toBe('plugin:dialog|save')+ expect(args).toEqual({+ options: {+ defaultPath: 'Untitled.fig',+ filters: [{ name: 'Figma file', extensions: ['fig'] }]+ }+ })+ return '/tmp/Untitled.fig'+ })++ await expect(chooseTauriFigSavePath()).resolves.toBe('/tmp/Untitled.fig')+ })+})diff --git a/tests/engine/tauri-fonts.test.ts b/tests/engine/tauri-fonts.test.tsnew file mode 100644index 000000000..0bdc49978--- /dev/null+++ b/tests/engine/tauri-fonts.test.ts@@ -0,0 +1,85 @@+import { afterEach, describe, expect, test, vi } from 'bun:test'++import { fontManager } from '@open-pencil/core/text'++import { clearTauriMocks, mockTauriIPC } from '../helpers/tauri-mocks'++class MockFontFace {+ family: string++ constructor(family: string) {+ this.family = family+ }++ async load() {+ return this+ }+}++function installFontFaceMocks() {+ const addedFaces: MockFontFace[] = []+ Object.assign(globalThis, {+ FontFace: MockFontFace,+ document: {+ fonts: {+ add(face: MockFontFace) {+ addedFaces.push(face)+ }+ }+ }+ })+ return addedFaces+}++afterEach(async () => {+ await clearTauriMocks()+ vi.restoreAllMocks()+ // @ts-expect-error test cleanup+ delete globalThis.document+ // @ts-expect-error test cleanup+ delete globalThis.FontFace+})++describe('Tauri font helpers', () => {+ test('lists system font families through mocked Tauri IPC', async () => {+ await mockTauriIPC((cmd) => {+ expect(cmd).toBe('list_system_fonts')+ return [{ family: 'System UI', styles: ['Regular', 'Bold'] }]+ })++ const { listFamilies, listFonts } = await import('@/app/editor/fonts')++ await expect(listFamilies()).resolves.toEqual(['System UI'])+ await expect(listFonts()).resolves.toEqual([{ family: 'System UI', styles: ['Regular', 'Bold'] }])+ })++ test('loads system font bytes and registers the face', async () => {+ const addedFaces = installFontFaceMocks()+ await mockTauriIPC((cmd, args) => {+ expect(cmd).toBe('load_system_font')+ expect(args).toEqual({ family: 'System UI', style: 'Bold Italic' })+ return [1, 2, 3, 4]+ })++ const { loadFont } = await import('@/app/editor/fonts')+ const buffer = await loadFont('System UI', 'Bold Italic')++ expect([...new Uint8Array(buffer ?? new ArrayBuffer(0))]).toEqual([1, 2, 3, 4])+ expect(fontManager.isLoaded('System UI', 'Bold Italic')).toBe(true)+ expect(addedFaces.map((face) => face.family)).toEqual(['System UI'])+ })++ test('falls back to font manager loading when the system font command fails', async () => {+ await mockTauriIPC((cmd) => {+ expect(cmd).toBe('load_system_font')+ throw new Error('missing system font')+ })+ const fallback = new Uint8Array([9, 8, 7]).buffer+ const loadFontSpy = vi.spyOn(fontManager, 'loadFont').mockResolvedValue(fallback)++ const { loadFont } = await import('@/app/editor/fonts')++ await expect(loadFont('Missing Family', 'Regular')).resolves.toBe(fallback)+ expect(loadFontSpy).toHaveBeenCalledWith('Missing Family', 'Regular')+ })+})diff --git a/tests/helpers/tauri-mocks.ts b/tests/helpers/tauri-mocks.tsindex c14005c7f..cf233ff2d 100644--- a/tests/helpers/tauri-mocks.ts+++ b/tests/helpers/tauri-mocks.ts@@ -6,10 +6,16 @@ export function installTauriMockWindow() {Object.assign(globalThis, { window: windowLike })}-export async function mockTauriIPC(handler: (cmd: string, args: unknown) => unknown) {+export async function mockTauriIPC(+ handler: (cmd: string, args: unknown, options?: unknown) => unknown+) {installTauriMockWindow()const { mockIPC } = await import('@tauri-apps/api/mocks')mockIPC(handler)+ const windowLike = window as typeof window & {+ __TAURI_INTERNALS__: { invoke: (cmd: string, args: unknown, options?: unknown) => Promise<unknown> }+ }+ windowLike.__TAURI_INTERNALS__.invoke = async (cmd, args, options) => handler(cmd, args, options)}export async function clearTauriMocks() {