From e433bed28eb2f75fc2f312e8b57c60e66084a981 Mon Sep 17 00:00:00 2001 From: Knotty Wyvern Date: Tue, 27 Oct 2026 19:47:39 -0700 Subject: [PATCH] Move the tests from scripts/ to tests/ by feature Unit tests go to tests/unit//, browser smoke tests to tests/smoke//, and tests against a running desktop app to tests/native/. Files named after dates, work passes, or Kanban cards get feature names, for example editorOctober12 -> editor/footnotes. scripts/ keeps the build, release, and package tools. Plugin repositories import scripts/packagePlugin.mjs, and the Terminal smoke test imports scripts/pluginMocks.mjs, which now re-exports the harness copy. The unit tests get their own type check (tests/tsconfig.json) with Node types. pnpm check runs it after the app check. Add @types/node and fix the three test mocks that it reported. --- CLAUDE.md | 2 +- docs/archive/development-0.1.8.md | 4 +- docs/archive/kanban-followup-2026-10-08.md | 2 +- docs/completion.md | 2 +- docs/design-decisions.md | 4 +- docs/development.md | 10 ++-- docs/menu-surfaces.json | 46 +++++++++---------- docs/plugin-host.md | 18 ++++---- docs/ui-color.md | 6 +-- docs/ui-design.md | 2 +- package.json | 5 +- pnpm-lock.yaml | 46 +++++++++++++------ scripts/pluginMocks.mjs | 42 +---------------- .../native/browser.native.mjs | 0 .../native/menuScope.native.mjs | 0 .../native/spelling.native.mjs | 0 .../tabTransferAndThemeExport.native.mjs | 0 .../native/treeRename.native.mjs | 0 tests/smoke/_harness/pluginMocks.mjs | 40 ++++++++++++++++ .../appearance}/backgroundFrames.smoke.mjs | 0 .../appearance/backgroundImages.smoke.mjs | 0 .../appearance}/backgroundLayout.smoke.mjs | 0 .../appearance/backgroundOverlay.smoke.mjs | 0 .../appearance}/characterThemes.smoke.mjs | 0 .../smoke/appearance/density.smoke.mjs | 0 .../smoke/appearance/palettes.smoke.mjs | 0 .../smoke/appearance/themeVariants.smoke.mjs | 0 .../appearance/tooltipsAndSelection.smoke.mjs | 0 .../smoke/appearance/typography.smoke.mjs | 0 .../smoke/browser/builtin.smoke.mjs | 0 .../smoke/browser/fields.smoke.mjs | 0 .../smoke/browser/interaction.smoke.mjs | 0 .../smoke/browser/settingsMenus.smoke.mjs | 0 .../smoke/browser/webData.smoke.mjs | 0 .../smoke/editor/checklistEntry.smoke.mjs | 0 .../smoke/editor}/codeBlocks.smoke.mjs | 0 .../smoke/editor}/dividers.smoke.mjs | 0 .../smoke/editor/emptyMenu.smoke.mjs | 0 .../smoke/editor/footnotes.smoke.mjs | 0 .../smoke/editor}/imageNavigation.smoke.mjs | 0 .../smoke/editor}/images.smoke.mjs | 0 .../smoke/editor/interactions.smoke.mjs | 0 .../smoke/editor}/markdownMenu.smoke.mjs | 2 +- .../smoke/editor}/markdownPaste.smoke.mjs | 0 .../smoke/editor}/pasteRepeat.smoke.mjs | 0 .../smoke/editor/properties.smoke.mjs | 0 .../smoke/editor/surfaces.smoke.mjs | 0 .../smoke/editor/templatesAndTasks.smoke.mjs | 0 .../smoke/editor}/undoHistory.smoke.mjs | 0 .../smoke/find/documentFind.smoke.mjs | 0 .../smoke/find/pluginViews.smoke.mjs | 4 +- .../smoke/find/searchPanel.smoke.mjs | 0 .../smoke/layout/outline.smoke.mjs | 0 .../smoke/layout/splits.smoke.mjs | 0 .../smoke/layout}/windowControls.smoke.mjs | 4 +- .../smoke/layout}/workbench.smoke.mjs | 4 +- .../smoke/links}/backlinks.smoke.mjs | 0 .../smoke/links/linkEditing.smoke.mjs | 0 .../smoke/links/linkMenus.smoke.mjs | 0 .../smoke/links/previewLinks.smoke.mjs | 0 .../smoke/links}/sectionLinks.smoke.mjs | 0 .../smoke/links}/workspaceLinks.smoke.mjs | 0 .../smoke/menus/consistency.smoke.mjs | 0 .../smoke/plugins/access.smoke.mjs | 0 .../smoke/plugins/choiceMenus.smoke.mjs | 2 +- .../smoke/plugins/install.smoke.mjs | 0 .../smoke/plugins/lifecycle.smoke.mjs | 2 +- .../renameMarksAndTemplates.smoke.mjs | 0 .../tooltipsAndBlankBrowser.smoke.mjs | 0 .../treeDragLinksAndGitToolbar.smoke.mjs | 0 .../workspaceShortcutsAndTemplates.smoke.mjs | 0 .../smoke/settings/density.smoke.mjs | 0 .../smoke/settings/displayLanguage.smoke.mjs | 0 .../smoke/settings/general.smoke.mjs | 2 +- .../smoke/settings/titlebar.smoke.mjs | 2 +- .../smoke/settings/window.smoke.mjs | 0 .../smoke/tables/drag.smoke.mjs | 0 .../smoke/tables/enterKey.smoke.mjs | 0 .../smoke/tables/formulas.smoke.mjs | 2 +- .../smoke/tables/linkCaret.smoke.mjs | 0 .../smoke/tables/navigation.smoke.mjs | 2 +- .../smoke/tables/selection.smoke.mjs | 0 .../smoke/tabs/lastTabAndSiteIcons.smoke.mjs | 0 .../smoke/tabs/lifecycle.smoke.mjs | 0 .../smoke/tabs/menus.smoke.mjs | 0 .../smoke/tabs/order.smoke.mjs | 0 .../smoke/tabs/ribbonDrop.smoke.mjs | 0 .../smoke/tabs/scroll.smoke.mjs | 0 .../smoke/tabs/transfer.smoke.mjs | 0 .../smoke/tree/actions.smoke.mjs | 0 .../smoke/tree/navigation.smoke.mjs | 0 .../smoke/tree/newFiles.smoke.mjs | 0 .../smoke/tree}/renameSelection.smoke.mjs | 0 .../smoke/tree}/renameTitle.smoke.mjs | 0 .../smoke/tree/renameUndo.smoke.mjs | 2 +- .../smoke/tree/selection.smoke.mjs | 0 .../smoke/workspace/openAndCreate.smoke.mjs | 0 tests/tsconfig.json | 11 +++++ .../unit/browser}/browserPlugin.spec.ts | 6 +-- .../unit/editor}/documentFind.spec.ts | 2 +- .../unit/editor/footnotes.spec.ts | 2 +- .../unit/editor}/headingMarks.spec.ts | 2 +- .../unit/editor}/htmlClipboard.spec.ts | 2 +- {scripts => tests/unit/editor}/images.spec.ts | 6 +-- .../unit/editor}/inlineMath.spec.ts | 4 +- .../unit/editor}/languageFor.spec.ts | 2 +- .../unit/editor}/markdownBlocks.spec.ts | 2 +- .../unit/editor}/markdownCommands.spec.ts | 2 +- {scripts => tests/unit/editor}/media.spec.ts | 2 +- .../unit/editor}/noteHtml.spec.ts | 2 +- {scripts => tests/unit/editor}/reader.spec.ts | 2 +- .../unit/editor}/writerMenu.spec.ts | 2 +- {scripts => tests/unit}/i18n.spec.ts | 6 +-- .../unit/layout}/documentPanes.spec.ts | 6 +-- .../unit/layout}/settings.spec.ts | 2 +- .../unit/layout}/splitLayout.spec.ts | 2 +- .../unit/layout}/tabActions.spec.ts | 4 +- .../unit/layout}/workbenchLayout.spec.ts | 2 +- .../unit/layout}/workbenchTabs.spec.ts | 6 +-- .../unit/links}/editorLinks.spec.ts | 2 +- .../unit/links}/headingLinks.spec.ts | 2 +- .../unit/links}/linkCommands.spec.ts | 4 +- .../unit/links}/markdownLinks.spec.ts | 4 +- .../unit/links}/tableLinkSource.spec.ts | 4 +- .../unit/links}/workspaceFileLink.spec.ts | 4 +- .../unit/plugins}/completion.spec.ts | 4 +- .../unit/plugins}/externalPlugins.spec.ts | 4 +- .../unit/plugins}/pluginAccess.spec.ts | 8 ++-- .../unit/plugins}/pluginDocuments.spec.ts | 4 +- .../plugins}/pluginHostExtensions.spec.ts | 7 +-- .../unit/plugins}/pluginPackaging.spec.ts | 2 +- .../unit/plugins}/plugins.spec.ts | 10 ++-- .../unit/release}/installerVersion.spec.ts | 2 +- .../unit/tables/formulas.spec.ts | 8 ++-- .../unit/tables}/markdownTable.spec.ts | 6 +-- .../unit/tables/selection.spec.ts | 10 ++-- .../unit/tables/structure.spec.ts | 4 +- .../unit/theme}/appearance.spec.ts | 6 +-- .../unit/theme}/asukaPalette.spec.ts | 2 +- .../unit/theme}/backgrounds.spec.ts | 10 ++-- .../unit/theme}/customThemes.spec.ts | 10 ++-- .../unit/theme}/malfoidPalette.spec.ts | 2 +- .../unit/theme}/themePalette.spec.ts | 2 +- .../unit/tree/actions.spec.ts | 6 +-- .../unit/tree/drop.spec.ts | 2 +- .../unit/tree/moveHistory.spec.ts | 2 +- .../unit/tree/selection.spec.ts | 4 +- .../unit/workspace}/chrome.spec.ts | 4 +- .../unit/workspace}/documentSession.spec.ts | 2 +- .../unit/workspace}/documents.spec.ts | 2 +- .../unit/workspace}/noteIndex.spec.ts | 2 +- .../unit/workspace}/renamePath.spec.ts | 2 +- tsconfig.json | 14 +++++- vite.config.js | 1 - 154 files changed, 269 insertions(+), 227 deletions(-) rename scripts/browserNativeAcceptance.mjs => tests/native/browser.native.mjs (100%) rename scripts/nativeMenuScope.smoke.mjs => tests/native/menuScope.native.mjs (100%) rename scripts/spellingNative.smoke.mjs => tests/native/spelling.native.mjs (100%) rename scripts/kanbanNative.smoke.mjs => tests/native/tabTransferAndThemeExport.native.mjs (100%) rename scripts/hostNavigationPass3.native.mjs => tests/native/treeRename.native.mjs (100%) create mode 100644 tests/smoke/_harness/pluginMocks.mjs rename {scripts => tests/smoke/appearance}/backgroundFrames.smoke.mjs (100%) rename scripts/appearancePass3.smoke.mjs => tests/smoke/appearance/backgroundImages.smoke.mjs (100%) rename {scripts => tests/smoke/appearance}/backgroundLayout.smoke.mjs (100%) rename scripts/overlayPercentage.smoke.mjs => tests/smoke/appearance/backgroundOverlay.smoke.mjs (100%) rename {scripts => tests/smoke/appearance}/characterThemes.smoke.mjs (100%) rename scripts/uiDensity.smoke.mjs => tests/smoke/appearance/density.smoke.mjs (100%) rename scripts/appearance.smoke.mjs => tests/smoke/appearance/palettes.smoke.mjs (100%) rename scripts/hostAppearance.smoke.mjs => tests/smoke/appearance/themeVariants.smoke.mjs (100%) rename scripts/october15Appearance.smoke.mjs => tests/smoke/appearance/tooltipsAndSelection.smoke.mjs (100%) rename scripts/themeTypography.smoke.mjs => tests/smoke/appearance/typography.smoke.mjs (100%) rename scripts/builtinBrowser.smoke.mjs => tests/smoke/browser/builtin.smoke.mjs (100%) rename scripts/browserFields.smoke.mjs => tests/smoke/browser/fields.smoke.mjs (100%) rename scripts/browserInteraction.smoke.mjs => tests/smoke/browser/interaction.smoke.mjs (100%) rename scripts/browserSettingsMenus.smoke.mjs => tests/smoke/browser/settingsMenus.smoke.mjs (100%) rename scripts/browserWebData.smoke.mjs => tests/smoke/browser/webData.smoke.mjs (100%) rename scripts/editorClipboardChecklist.smoke.mjs => tests/smoke/editor/checklistEntry.smoke.mjs (100%) rename {scripts => tests/smoke/editor}/codeBlocks.smoke.mjs (100%) rename {scripts => tests/smoke/editor}/dividers.smoke.mjs (100%) rename scripts/editorEmptyMenu.smoke.mjs => tests/smoke/editor/emptyMenu.smoke.mjs (100%) rename scripts/editorOctober12.smoke.mjs => tests/smoke/editor/footnotes.smoke.mjs (100%) rename {scripts => tests/smoke/editor}/imageNavigation.smoke.mjs (100%) rename {scripts => tests/smoke/editor}/images.smoke.mjs (100%) rename scripts/editorInteractions.smoke.mjs => tests/smoke/editor/interactions.smoke.mjs (100%) rename {scripts => tests/smoke/editor}/markdownMenu.smoke.mjs (99%) rename {scripts => tests/smoke/editor}/markdownPaste.smoke.mjs (100%) rename {scripts => tests/smoke/editor}/pasteRepeat.smoke.mjs (100%) rename scripts/propertiesInitial.smoke.mjs => tests/smoke/editor/properties.smoke.mjs (100%) rename scripts/editorSurfaces.smoke.mjs => tests/smoke/editor/surfaces.smoke.mjs (100%) rename scripts/editorTemplateHyphen.smoke.mjs => tests/smoke/editor/templatesAndTasks.smoke.mjs (100%) rename {scripts => tests/smoke/editor}/undoHistory.smoke.mjs (100%) rename scripts/unifiedFind.smoke.mjs => tests/smoke/find/documentFind.smoke.mjs (100%) rename scripts/pluginFind.smoke.mjs => tests/smoke/find/pluginViews.smoke.mjs (97%) rename scripts/find.smoke.mjs => tests/smoke/find/searchPanel.smoke.mjs (100%) rename scripts/workbenchLayout.smoke.mjs => tests/smoke/layout/outline.smoke.mjs (100%) rename scripts/documentSplits.smoke.mjs => tests/smoke/layout/splits.smoke.mjs (100%) rename {scripts => tests/smoke/layout}/windowControls.smoke.mjs (95%) rename {scripts => tests/smoke/layout}/workbench.smoke.mjs (99%) rename {scripts => tests/smoke/links}/backlinks.smoke.mjs (100%) rename scripts/editorLinkEditing.smoke.mjs => tests/smoke/links/linkEditing.smoke.mjs (100%) rename scripts/editorLinkMenus.smoke.mjs => tests/smoke/links/linkMenus.smoke.mjs (100%) rename scripts/editorPreviewLinks.smoke.mjs => tests/smoke/links/previewLinks.smoke.mjs (100%) rename {scripts => tests/smoke/links}/sectionLinks.smoke.mjs (100%) rename {scripts => tests/smoke/links}/workspaceLinks.smoke.mjs (100%) rename scripts/menuConsistency.smoke.mjs => tests/smoke/menus/consistency.smoke.mjs (100%) rename scripts/pluginAccess.smoke.mjs => tests/smoke/plugins/access.smoke.mjs (100%) rename scripts/pluginChoiceMenus.smoke.mjs => tests/smoke/plugins/choiceMenus.smoke.mjs (97%) rename scripts/pluginInstall.smoke.mjs => tests/smoke/plugins/install.smoke.mjs (100%) rename scripts/plugins.smoke.mjs => tests/smoke/plugins/lifecycle.smoke.mjs (99%) rename scripts/hostTodo.smoke.mjs => tests/smoke/regressions/renameMarksAndTemplates.smoke.mjs (100%) rename scripts/todoUi.smoke.mjs => tests/smoke/regressions/tooltipsAndBlankBrowser.smoke.mjs (100%) rename scripts/kanbanRoot.smoke.mjs => tests/smoke/regressions/treeDragLinksAndGitToolbar.smoke.mjs (100%) rename scripts/kanbanWorkspace.smoke.mjs => tests/smoke/regressions/workspaceShortcutsAndTemplates.smoke.mjs (100%) rename scripts/settingsDensity.smoke.mjs => tests/smoke/settings/density.smoke.mjs (100%) rename scripts/appearanceLanguage.smoke.mjs => tests/smoke/settings/displayLanguage.smoke.mjs (100%) rename scripts/settings.smoke.mjs => tests/smoke/settings/general.smoke.mjs (98%) rename scripts/settingsTitlebar.smoke.mjs => tests/smoke/settings/titlebar.smoke.mjs (97%) rename scripts/settingsWindow.smoke.mjs => tests/smoke/settings/window.smoke.mjs (100%) rename scripts/tableDrag.smoke.mjs => tests/smoke/tables/drag.smoke.mjs (100%) rename scripts/october15Editor.smoke.mjs => tests/smoke/tables/enterKey.smoke.mjs (100%) rename scripts/tableFormulas.smoke.mjs => tests/smoke/tables/formulas.smoke.mjs (99%) rename scripts/tableLinkCaret.smoke.mjs => tests/smoke/tables/linkCaret.smoke.mjs (100%) rename scripts/tableNavigation.smoke.mjs => tests/smoke/tables/navigation.smoke.mjs (99%) rename scripts/tableSelection.smoke.mjs => tests/smoke/tables/selection.smoke.mjs (100%) rename scripts/pluginTabOrder.smoke.mjs => tests/smoke/tabs/lastTabAndSiteIcons.smoke.mjs (100%) rename scripts/tabLifecycle.smoke.mjs => tests/smoke/tabs/lifecycle.smoke.mjs (100%) rename scripts/tabMenus.smoke.mjs => tests/smoke/tabs/menus.smoke.mjs (100%) rename scripts/tabOrder.smoke.mjs => tests/smoke/tabs/order.smoke.mjs (100%) rename scripts/tabRibbonDrop.smoke.mjs => tests/smoke/tabs/ribbonDrop.smoke.mjs (100%) rename scripts/tabScroll.smoke.mjs => tests/smoke/tabs/scroll.smoke.mjs (100%) rename scripts/tabTransfer.smoke.mjs => tests/smoke/tabs/transfer.smoke.mjs (100%) rename scripts/treeActions.smoke.mjs => tests/smoke/tree/actions.smoke.mjs (100%) rename scripts/todoNavigation.smoke.mjs => tests/smoke/tree/navigation.smoke.mjs (100%) rename scripts/editorFiles.smoke.mjs => tests/smoke/tree/newFiles.smoke.mjs (100%) rename {scripts => tests/smoke/tree}/renameSelection.smoke.mjs (100%) rename {scripts => tests/smoke/tree}/renameTitle.smoke.mjs (100%) rename scripts/hostNavigationPass3.smoke.mjs => tests/smoke/tree/renameUndo.smoke.mjs (99%) rename scripts/treeSelection.smoke.mjs => tests/smoke/tree/selection.smoke.mjs (100%) rename scripts/workspaces.smoke.mjs => tests/smoke/workspace/openAndCreate.smoke.mjs (100%) create mode 100644 tests/tsconfig.json rename {scripts => tests/unit/browser}/browserPlugin.spec.ts (91%) rename {scripts => tests/unit/editor}/documentFind.spec.ts (93%) rename scripts/editorOctober12.spec.ts => tests/unit/editor/footnotes.spec.ts (94%) rename {scripts => tests/unit/editor}/headingMarks.spec.ts (83%) rename {scripts => tests/unit/editor}/htmlClipboard.spec.ts (92%) rename {scripts => tests/unit/editor}/images.spec.ts (94%) rename {scripts => tests/unit/editor}/inlineMath.spec.ts (94%) rename {scripts => tests/unit/editor}/languageFor.spec.ts (89%) rename {scripts => tests/unit/editor}/markdownBlocks.spec.ts (95%) rename {scripts => tests/unit/editor}/markdownCommands.spec.ts (98%) rename {scripts => tests/unit/editor}/media.spec.ts (96%) rename {scripts => tests/unit/editor}/noteHtml.spec.ts (96%) rename {scripts => tests/unit/editor}/reader.spec.ts (99%) rename {scripts => tests/unit/editor}/writerMenu.spec.ts (99%) rename {scripts => tests/unit}/i18n.spec.ts (96%) rename {scripts => tests/unit/layout}/documentPanes.spec.ts (93%) rename {scripts => tests/unit/layout}/settings.spec.ts (96%) rename {scripts => tests/unit/layout}/splitLayout.spec.ts (94%) rename {scripts => tests/unit/layout}/tabActions.spec.ts (93%) rename {scripts => tests/unit/layout}/workbenchLayout.spec.ts (94%) rename {scripts => tests/unit/layout}/workbenchTabs.spec.ts (89%) rename {scripts => tests/unit/links}/editorLinks.spec.ts (95%) rename {scripts => tests/unit/links}/headingLinks.spec.ts (96%) rename {scripts => tests/unit/links}/linkCommands.spec.ts (89%) rename {scripts => tests/unit/links}/markdownLinks.spec.ts (87%) rename {scripts => tests/unit/links}/tableLinkSource.spec.ts (88%) rename {scripts => tests/unit/links}/workspaceFileLink.spec.ts (84%) rename {scripts => tests/unit/plugins}/completion.spec.ts (94%) rename {scripts => tests/unit/plugins}/externalPlugins.spec.ts (98%) rename {scripts => tests/unit/plugins}/pluginAccess.spec.ts (92%) rename {scripts => tests/unit/plugins}/pluginDocuments.spec.ts (96%) rename {scripts => tests/unit/plugins}/pluginHostExtensions.spec.ts (91%) rename {scripts => tests/unit/plugins}/pluginPackaging.spec.ts (97%) rename {scripts => tests/unit/plugins}/plugins.spec.ts (90%) rename {scripts => tests/unit/release}/installerVersion.spec.ts (98%) rename scripts/tableFormulas.spec.ts => tests/unit/tables/formulas.spec.ts (87%) rename {scripts => tests/unit/tables}/markdownTable.spec.ts (96%) rename scripts/tableSelection.spec.ts => tests/unit/tables/selection.spec.ts (93%) rename scripts/tableStructure.spec.ts => tests/unit/tables/structure.spec.ts (97%) rename {scripts => tests/unit/theme}/appearance.spec.ts (96%) rename {scripts => tests/unit/theme}/asukaPalette.spec.ts (96%) rename {scripts => tests/unit/theme}/backgrounds.spec.ts (94%) rename {scripts => tests/unit/theme}/customThemes.spec.ts (94%) rename {scripts => tests/unit/theme}/malfoidPalette.spec.ts (95%) rename {scripts => tests/unit/theme}/themePalette.spec.ts (97%) rename scripts/treeActions.spec.ts => tests/unit/tree/actions.spec.ts (93%) rename scripts/treeDrop.spec.ts => tests/unit/tree/drop.spec.ts (98%) rename scripts/treeMoveHistory.spec.ts => tests/unit/tree/moveHistory.spec.ts (93%) rename scripts/treeSelection.spec.ts => tests/unit/tree/selection.spec.ts (97%) rename {scripts => tests/unit/workspace}/chrome.spec.ts (89%) rename {scripts => tests/unit/workspace}/documentSession.spec.ts (96%) rename {scripts => tests/unit/workspace}/documents.spec.ts (99%) rename {scripts => tests/unit/workspace}/noteIndex.spec.ts (98%) rename {scripts => tests/unit/workspace}/renamePath.spec.ts (97%) diff --git a/CLAUDE.md b/CLAUDE.md index 1b9c588..7bfd29a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -107,7 +107,7 @@ Rules from the owner: - A selection gets one outline around each group of adjacent selected items, with no borders on shared internal edges. - Colors follow the `ui-functional-color` skill and `docs/ui-color.md`: vivid by default, informative text opaque. - Before Review, check both themes, narrow windows, long lists, keyboard focus, and viewport edges. - For menu work, run `pnpm check:menus` and `scripts/menuConsistency.smoke.mjs`. + For menu work, run `pnpm check:menus` and `tests/smoke/menus/consistency.smoke.mjs`. Keep screenshots of the exact control that the card names. - Record a rule change, a recurring problem, or an exception in `docs/design-decisions.md`. An isolated fix needs no entry. diff --git a/docs/archive/development-0.1.8.md b/docs/archive/development-0.1.8.md index 9c3d906..7752cf0 100644 --- a/docs/archive/development-0.1.8.md +++ b/docs/archive/development-0.1.8.md @@ -14,6 +14,6 @@ The separate window has dedicated native permissions and loads only the browser Plugin installation still lists all installed plugins. Live Markdown formatting refreshes when background parsing finishes after a large paste. -Run `scripts/markdownPaste.smoke.mjs` against the development server to check pasted source and rendered formatting. -Run `scripts/settingsWindow.smoke.mjs` to check the Settings layout, save synchronization, and mocked native requests. +Run `tests/smoke/editor/markdownPaste.smoke.mjs` against the development server to check pasted source and rendered formatting. +Run `tests/smoke/settings/window.smoke.mjs` to check the Settings layout, save synchronization, and mocked native requests. The browser checks do not test native title-bar movement or desktop clipboard behavior. diff --git a/docs/archive/kanban-followup-2026-10-08.md b/docs/archive/kanban-followup-2026-10-08.md index 912b941..8407fb3 100644 --- a/docs/archive/kanban-followup-2026-10-08.md +++ b/docs/archive/kanban-followup-2026-10-08.md @@ -35,5 +35,5 @@ The Git ZIP requires the matching host build. Earlier hosts show an update messa Screenshots and check logs are in `.audit/`. Git screenshots are in `../RuneStone_Git/output/`. The native Windows check confirmed real WebView2 commands in the shared menu. Native Undo restored Writer text in an isolated test profile. That profile supplied no spelling suggestions. Correction and undo with a spelling suggestion still need desktop acceptance. -The reusable check is `scripts/spellingNative.smoke.mjs`. Set `REQUIRE_NATIVE_SUGGESTIONS=1` to require an actual suggestion. +The reusable check is `tests/native/spelling.native.mjs`. Set `REQUIRE_NATIVE_SUGGESTIONS=1` to require an actual suggestion. Cards move to Review after their checks pass. Done remains reserved for user acceptance. diff --git a/docs/completion.md b/docs/completion.md index 43b8a2f..8760c5d 100644 --- a/docs/completion.md +++ b/docs/completion.md @@ -114,4 +114,4 @@ Abort stops the display at once. A blocked network read can continue until the r Plugins keep full application access. This API does not add a permission sandbox. The API does not include context sources, remote model servers, or credential storage. -For tests, see `scripts/completion.spec.ts`. For a provider plugin, see the [Local Autocomplete trial guide](https://git.knottywyvern.com/kwyvern/RuneStone_LocalModel/src/branch/main/docs/trial-guide.md). +For tests, see `tests/unit/plugins/completion.spec.ts`. For a provider plugin, see the [Local Autocomplete trial guide](https://git.knottywyvern.com/kwyvern/RuneStone_LocalModel/src/branch/main/docs/trial-guide.md). diff --git a/docs/design-decisions.md b/docs/design-decisions.md index 814518e..921fcc2 100644 --- a/docs/design-decisions.md +++ b/docs/design-decisions.md @@ -562,8 +562,8 @@ Replaced by: [UI-024](#ui-024--assertive-functional-color-by-default) strengthen - Scope: Host menus, image surfaces, compatible plugin surfaces, and custom theme import and export. - Shared implementation: appearance.ts, customThemes.ts, and the surface-opacity tokens in tokens.css. - Compatibility: Default surface and editor tints remain 82% and 90%. Schema 1 files remain importable. -- Evidence: scripts/appearanceLanguage.smoke.mjs, scripts/customThemes.spec.ts, and the affected cards retain checks and screenshots. -- Follow-up evidence: Cards 5a56a250-b46a-4319-8f25-5f6ac4362a32, 682ad51f-66a1-477d-b02e-c1acb1c14d4e, and 97fe6f6b-5780-436e-abd8-a8135efbbe87 cover the full range, themed slider, and missing font stacks. `scripts/hostAppearance.smoke.mjs` checks the exact controls and exports. +- Evidence: tests/smoke/settings/displayLanguage.smoke.mjs, tests/unit/theme/customThemes.spec.ts, and the affected cards retain checks and screenshots. +- Follow-up evidence: Cards 5a56a250-b46a-4319-8f25-5f6ac4362a32, 682ad51f-66a1-477d-b02e-c1acb1c14d4e, and 97fe6f6b-5780-436e-abd8-a8135efbbe87 cover the full range, themed slider, and missing font stacks. `tests/smoke/appearance/themeVariants.smoke.mjs` checks the exact controls and exports. - Limits: Browser checks use desktop mocks. Native display and user acceptance remain open. ### UI-029 — Text selection transparency diff --git a/docs/development.md b/docs/development.md index 8200a22..eafa299 100644 --- a/docs/development.md +++ b/docs/development.md @@ -133,13 +133,13 @@ Run these commands from the repository folder. They do not need an installer. | `pnpm build` | The production frontend build | | `pnpm check:menus` | The inventory of menu surfaces. See [Interface design](ui-design.md). | -To run one test file, use `node --experimental-strip-types --test scripts/tableSelection.spec.ts`. +To run one test file, use `node --experimental-strip-types --test tests/unit/tables/selection.spec.ts`. For type errors while you edit, run `pnpm check:watch`. Some tests need files from outside this repository: -- `scripts/plugins.spec.ts` and `scripts/tableFormulas.spec.ts` import the compiled Table Formulas package. Run `pnpm build:plugins` first. See [Build examples](plugin-development.md#build-examples). -- `scripts/installerVersion.spec.ts` needs the NSIS compiler that the Tauri CLI downloads on Windows. +- `tests/unit/plugins/plugins.spec.ts` and `tests/unit/tables/formulas.spec.ts` import the compiled Table Formulas package. Run `pnpm build:plugins` first. See [Build examples](plugin-development.md#build-examples). +- `tests/unit/release/installerVersion.spec.ts` needs the NSIS compiler that the Tauri CLI downloads on Windows. - The Rust terminal tests start the real shells on the computer. ## Browser smoke tests @@ -151,14 +151,14 @@ They do not replace tests in the native app. Real folder access, file writes, an Set `PLAYWRIGHT_MODULE` to the folder of an installed `playwright` package. If that package has no Chromium, set `CHROME_PATH` to an installed browser. 2. Start the frontend with `pnpm dev`, or use the server of a running `pnpm tauri dev` session. -3. In a second terminal, run one script, for example `node scripts/workbench.smoke.mjs`. +3. In a second terminal, run one script, for example `node tests/smoke/layout/workbench.smoke.mjs`. Example for PowerShell. Replace the paths with your own: ```powershell $env:PLAYWRIGHT_MODULE = "C:\tools\browser-tests\node_modules\playwright" $env:CHROME_PATH = "C:\Program Files\Google\Chrome\Application\chrome.exe" -node scripts/workbench.smoke.mjs +node tests/smoke/layout/workbench.smoke.mjs ``` | Variable | Use | diff --git a/docs/menu-surfaces.json b/docs/menu-surfaces.json index 3b53520..5a6d93f 100644 --- a/docs/menu-surfaces.json +++ b/docs/menu-surfaces.json @@ -22,7 +22,7 @@ "action": 2 }, "design": "Shared action menu", - "check": "scripts/builtinBrowser.smoke.mjs; scripts/browserWebData.smoke.mjs" + "check": "tests/smoke/browser/builtin.smoke.mjs; tests/smoke/browser/webData.smoke.mjs" }, "RuneStone/src/lib/browser/Settings.svelte": { "counts": { @@ -30,77 +30,77 @@ "localPopup": 2 }, "design": "Shared action menu", - "check": "scripts/builtinBrowser.smoke.mjs; scripts/browserWebData.smoke.mjs" + "check": "tests/smoke/browser/builtin.smoke.mjs; tests/smoke/browser/webData.smoke.mjs" }, "RuneStone/src/lib/browser/WebData.svelte": { "counts": { "action": 1 }, "design": "Shared action menu", - "check": "scripts/builtinBrowser.smoke.mjs; scripts/browserWebData.smoke.mjs" + "check": "tests/smoke/browser/builtin.smoke.mjs; tests/smoke/browser/webData.smoke.mjs" }, "RuneStone/src/lib/editor/codeMenu.ts": { "counts": { "action": 1 }, "design": "Shared action menu", - "check": "scripts/menuConsistency.smoke.mjs; scripts/editorLinkEditing.smoke.mjs; scripts/editorSurfaces.smoke.mjs" + "check": "tests/smoke/menus/consistency.smoke.mjs; tests/smoke/links/linkEditing.smoke.mjs; tests/smoke/editor/surfaces.smoke.mjs" }, "RuneStone/src/lib/editor/imageControls.ts": { "counts": { "action": 1 }, "design": "Shared action menu", - "check": "scripts/menuConsistency.smoke.mjs; scripts/editorLinkEditing.smoke.mjs; scripts/editorSurfaces.smoke.mjs" + "check": "tests/smoke/menus/consistency.smoke.mjs; tests/smoke/links/linkEditing.smoke.mjs; tests/smoke/editor/surfaces.smoke.mjs" }, "RuneStone/src/lib/editor/markdownMenu.ts": { "counts": { "action": 2 }, "design": "Shared action menu", - "check": "scripts/menuConsistency.smoke.mjs; scripts/editorLinkEditing.smoke.mjs; scripts/editorSurfaces.smoke.mjs" + "check": "tests/smoke/menus/consistency.smoke.mjs; tests/smoke/links/linkEditing.smoke.mjs; tests/smoke/editor/surfaces.smoke.mjs" }, "RuneStone/src/lib/editor/readingMenu.ts": { "counts": { "action": 1 }, "design": "Shared action menu", - "check": "scripts/menuConsistency.smoke.mjs; scripts/editorLinkEditing.smoke.mjs; scripts/editorSurfaces.smoke.mjs" + "check": "tests/smoke/menus/consistency.smoke.mjs; tests/smoke/links/linkEditing.smoke.mjs; tests/smoke/editor/surfaces.smoke.mjs" }, "RuneStone/src/lib/editor/spellingMenu.ts": { "counts": { "action": 1 }, "design": "Shared action menu", - "check": "scripts/menuConsistency.smoke.mjs; scripts/editorLinkEditing.smoke.mjs; scripts/editorSurfaces.smoke.mjs" + "check": "tests/smoke/menus/consistency.smoke.mjs; tests/smoke/links/linkEditing.smoke.mjs; tests/smoke/editor/surfaces.smoke.mjs" }, "RuneStone/src/lib/editor/tableSelectionControls.ts": { "counts": { "action": 1 }, "design": "Shared action menu", - "check": "scripts/menuConsistency.smoke.mjs; scripts/editorLinkEditing.smoke.mjs; scripts/editorSurfaces.smoke.mjs" + "check": "tests/smoke/menus/consistency.smoke.mjs; tests/smoke/links/linkEditing.smoke.mjs; tests/smoke/editor/surfaces.smoke.mjs" }, "RuneStone/src/lib/editor/WriterHost.svelte": { "counts": { "svelteMenu": 1 }, "design": "Shared action menu", - "check": "scripts/menuConsistency.smoke.mjs; scripts/editorLinkEditing.smoke.mjs; scripts/editorSurfaces.smoke.mjs" + "check": "tests/smoke/menus/consistency.smoke.mjs; tests/smoke/links/linkEditing.smoke.mjs; tests/smoke/editor/surfaces.smoke.mjs" }, "RuneStone/src/lib/layout/ContextMenu.svelte": { "counts": { "action": 1 }, "design": "Shared action menu", - "check": "scripts/menuConsistency.smoke.mjs" + "check": "tests/smoke/menus/consistency.smoke.mjs" }, "RuneStone/src/lib/layout/FileTree.svelte": { "counts": { "svelteMenu": 1 }, "design": "Shared action menu", - "check": "scripts/menuConsistency.smoke.mjs" + "check": "tests/smoke/menus/consistency.smoke.mjs" }, "RuneStone/src/lib/layout/QuickOpen.svelte": { "counts": { @@ -108,21 +108,21 @@ "localPopup": 3 }, "design": "Shared searchable picker used by quick file open and document link picker", - "check": "scripts/workspaces.smoke.mjs; scripts/editorLinkMenus.smoke.mjs" + "check": "tests/smoke/workspace/openAndCreate.smoke.mjs; tests/smoke/links/linkMenus.smoke.mjs" }, "RuneStone/src/lib/layout/TabBar.svelte": { "counts": { "action": 1 }, "design": "Shared action menu", - "check": "scripts/menuConsistency.smoke.mjs" + "check": "tests/smoke/menus/consistency.smoke.mjs" }, "RuneStone/src/lib/layout/Workbench.svelte": { "counts": { "action": 1 }, "design": "Shared action menu", - "check": "scripts/menuConsistency.smoke.mjs" + "check": "tests/smoke/menus/consistency.smoke.mjs" }, "RuneStone/src/lib/layout/WorkspacePicker.svelte": { "counts": { @@ -130,21 +130,21 @@ "localPopup": 8 }, "design": "Shared rich picker; paths retain a detail row", - "check": "scripts/workspaces.smoke.mjs" + "check": "tests/smoke/workspace/openAndCreate.smoke.mjs" }, "RuneStone/src/lib/plugins/externalSession.ts": { "counts": { "action": 1 }, "design": "Shared action menu", - "check": "scripts/menuConsistency.smoke.mjs" + "check": "tests/smoke/menus/consistency.smoke.mjs" }, "RuneStone/src/lib/plugins/PluginAccessMenu.svelte": { "counts": { "svelteMenu": 1 }, "design": "Shared action menu", - "check": "scripts/menuConsistency.smoke.mjs" + "check": "tests/smoke/menus/consistency.smoke.mjs" }, "RuneStone/src/lib/plugins/sdk.ts": { "counts": { @@ -159,7 +159,7 @@ "localPopup": 3 }, "design": "Shared action menu", - "check": "scripts/characterThemes.smoke.mjs" + "check": "tests/smoke/appearance/characterThemes.smoke.mjs" }, "RuneStone/src/lib/ui/actionMenu.ts": { "counts": { @@ -167,14 +167,14 @@ "localPopup": 2 }, "design": "Shared action menu", - "check": "scripts/menuConsistency.smoke.mjs" + "check": "tests/smoke/menus/consistency.smoke.mjs" }, "RuneStone/src/lib/ui/managedActionMenu.ts": { "counts": { "action": 2 }, "design": "Shared action menu", - "check": "scripts/menuConsistency.smoke.mjs" + "check": "tests/smoke/menus/consistency.smoke.mjs" }, "RuneStone_Project_Management/src/choices-ui.ts": { "counts": { @@ -296,7 +296,7 @@ "nativeChoice": 1 }, "design": "Host radio menu; native server select only on older hosts", - "check": "scripts/pluginChoiceMenus.smoke.mjs" + "check": "tests/smoke/plugins/choiceMenus.smoke.mjs" }, "RuneStone_Git/src/view.js": { "counts": { @@ -320,7 +320,7 @@ "localPopup": 1 }, "design": "Shared action menu for interface language; settings retain ordinary controls", - "check": "scripts/appearanceLanguage.smoke.mjs; scripts/menuConsistency.smoke.mjs" + "check": "tests/smoke/settings/displayLanguage.smoke.mjs; tests/smoke/menus/consistency.smoke.mjs" }, "RuneStone_Project_Management/src/workspace-default.ts": { "counts": { diff --git a/docs/plugin-host.md b/docs/plugin-host.md index 64aaeb4..f9f7190 100644 --- a/docs/plugin-host.md +++ b/docs/plugin-host.md @@ -148,13 +148,13 @@ For the general checks, see [Checks](development.md#checks). For the browser set Some tests load the compiled feature plugins: -- `pnpm build:plugins` makes `plugin-packages/table-formulas/`. `scripts/plugins.spec.ts` and the feature smoke tests need it. +- `pnpm build:plugins` makes `plugin-packages/table-formulas/`. `tests/unit/plugins/plugins.spec.ts` and the feature smoke tests need it. - The smoke tests read Terminal from `../RuneStone_Terminal/dist/`. To make it without a release ZIP, run `node scripts/build.mjs --no-package` in the Terminal folder. Set `RUNESTONE_TERMINAL_DIST` to use another folder. Unit tests: ```powershell -node --experimental-strip-types --test scripts/plugins.spec.ts scripts/externalPlugins.spec.ts scripts/pluginPackaging.spec.ts scripts/pluginHostExtensions.spec.ts scripts/pluginDocuments.spec.ts scripts/pluginAccess.spec.ts scripts/completion.spec.ts scripts/backgrounds.spec.ts +node --experimental-strip-types --test tests/unit/plugins/plugins.spec.ts tests/unit/plugins/externalPlugins.spec.ts tests/unit/plugins/pluginPackaging.spec.ts tests/unit/plugins/pluginHostExtensions.spec.ts tests/unit/plugins/pluginDocuments.spec.ts tests/unit/plugins/pluginAccess.spec.ts tests/unit/plugins/completion.spec.ts tests/unit/theme/backgrounds.spec.ts ``` Native tests use real temporary files and archives: @@ -166,13 +166,13 @@ cargo test --manifest-path src-tauri/Cargo.toml --lib plugin Browser smoke tests mock desktop calls and use the real interface and module loader. Run them while `pnpm dev` runs: ```powershell -node scripts/pluginInstall.smoke.mjs -node scripts/plugins.smoke.mjs -node scripts/pluginAccess.smoke.mjs -node scripts/pluginChoiceMenus.smoke.mjs -node scripts/pluginFind.smoke.mjs -node scripts/pluginTabOrder.smoke.mjs -node scripts/settings.smoke.mjs +node tests/smoke/plugins/install.smoke.mjs +node tests/smoke/plugins/lifecycle.smoke.mjs +node tests/smoke/plugins/access.smoke.mjs +node tests/smoke/plugins/choiceMenus.smoke.mjs +node tests/smoke/find/pluginViews.smoke.mjs +node tests/smoke/tabs/lastTabAndSiteIcons.smoke.mjs +node tests/smoke/settings/general.smoke.mjs ``` `pluginInstall.smoke.mjs` covers the link form, download errors, token clearing, cancel, focus, and disabled installation. diff --git a/docs/ui-color.md b/docs/ui-color.md index b1effda..719fd58 100644 --- a/docs/ui-color.md +++ b/docs/ui-color.md @@ -55,9 +55,9 @@ The [October 13 menu and color review](archive/menu-audit-2026-10-13.md) holds t | Pair | Minimum | Test | | --- | --- | --- | -| `text`, `text-dim`, `text-strong`, and `accent` on `bg`, `bg-elevated`, `bg-active`, and `selection` | 4.5:1 | `scripts/appearance.spec.ts`, `scripts/themePalette.spec.ts` | -| Each syntax role on `bg` and `bg-active` | 4.5:1 | `scripts/appearance.spec.ts` | -| Accent selection perimeter on the selection fill | 3:1 | `scripts/malfoidPalette.spec.ts` | +| `text`, `text-dim`, `text-strong`, and `accent` on `bg`, `bg-elevated`, `bg-active`, and `selection` | 4.5:1 | `tests/unit/theme/appearance.spec.ts`, `tests/unit/theme/themePalette.spec.ts` | +| Each syntax role on `bg` and `bg-active` | 4.5:1 | `tests/unit/theme/appearance.spec.ts` | +| Accent selection perimeter on the selection fill | 3:1 | `tests/unit/theme/malfoidPalette.spec.ts` | `accent` on `selection` is exempt from the 4.5:1 text check. Run the tests with `pnpm test`. Over a user image, contrast depends on the composite surface. Measure the 82% and 90% tints over the image that the change uses. Do not claim contrast over every possible image or overlay. diff --git a/docs/ui-design.md b/docs/ui-design.md index 2f9c6b1..4698037 100644 --- a/docs/ui-design.md +++ b/docs/ui-design.md @@ -281,7 +281,7 @@ Run these checks: | Change | Command | | --- | --- | -| Shared menu code | `node scripts/menuConsistency.smoke.mjs` against the [development server](development.md#run-from-source). Set `SMOKE_URL` for a different server. Set `PLAYWRIGHT_MODULE` and `CHROME_PATH` when the environment needs explicit paths. | +| Shared menu code | `node tests/smoke/menus/consistency.smoke.mjs` against the [development server](development.md#run-from-source). Set `SMOKE_URL` for a different server. Set `PLAYWRIGHT_MODULE` and `CHROME_PATH` when the environment needs explicit paths. | | Any menu, select, or picker work | `pnpm check:menus` (runs `node scripts/menuSurfaceAudit.mjs`) before Review | The audit compares source entry points with the inventory in `docs/menu-surfaces.json`, across the host and sibling plugins. A new or changed entry point needs an inventory review. The audit covers source only. It does not prove runtime compliance. diff --git a/package.json b/package.json index 6c14618..e4c661f 100644 --- a/package.json +++ b/package.json @@ -9,11 +9,11 @@ "build:installer": "node scripts/buildInstaller.mjs", "preview": "vite preview", "prepare": "svelte-kit sync || echo ''", - "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json && svelte-check --tsconfig ./tests/tsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", "check:menus": "node scripts/menuSurfaceAudit.mjs", "tauri": "tauri", - "test": "node --experimental-strip-types --test scripts/*.spec.ts", + "test": "node --experimental-strip-types --test \"tests/unit/**/*.spec.ts\"", "build:plugins": "node scripts/buildPlugins.mjs", "browser:check": "npm --prefix browser-runtime run check", "browser:test": "npm --prefix browser-runtime test", @@ -55,6 +55,7 @@ "@sveltejs/kit": "^2.65.1", "@sveltejs/vite-plugin-svelte": "^7.1.2", "@tauri-apps/cli": "^2", + "@types/node": "24.19.2", "svelte": "^5.56.3", "svelte-check": "^4.6.0", "typescript": "~6.0.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e637621..13df774 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -89,16 +89,19 @@ importers: devDependencies: '@sveltejs/adapter-static': specifier: ^3.0.10 - version: 3.0.10(@sveltejs/kit@2.70.3(@sveltejs/vite-plugin-svelte@7.3.0(svelte@5.57.1)(vite@8.3.0))(svelte@5.57.1)(typescript@6.0.3)(vite@8.3.0)) + version: 3.0.10(@sveltejs/kit@2.70.3(@sveltejs/vite-plugin-svelte@7.3.0(svelte@5.57.1)(vite@8.3.0(@types/node@24.19.2)))(svelte@5.57.1)(typescript@6.0.3)(vite@8.3.0(@types/node@24.19.2))) '@sveltejs/kit': specifier: ^2.65.1 - version: 2.70.3(@sveltejs/vite-plugin-svelte@7.3.0(svelte@5.57.1)(vite@8.3.0))(svelte@5.57.1)(typescript@6.0.3)(vite@8.3.0) + version: 2.70.3(@sveltejs/vite-plugin-svelte@7.3.0(svelte@5.57.1)(vite@8.3.0(@types/node@24.19.2)))(svelte@5.57.1)(typescript@6.0.3)(vite@8.3.0(@types/node@24.19.2)) '@sveltejs/vite-plugin-svelte': specifier: ^7.1.2 - version: 7.3.0(svelte@5.57.1)(vite@8.3.0) + version: 7.3.0(svelte@5.57.1)(vite@8.3.0(@types/node@24.19.2)) '@tauri-apps/cli': specifier: ^2 version: 2.11.4 + '@types/node': + specifier: 24.19.2 + version: 24.19.2 svelte: specifier: ^5.56.3 version: 5.57.1 @@ -110,7 +113,7 @@ importers: version: 6.0.3 vite: specifier: ^8.0.16 - version: 8.3.0 + version: 8.3.0(@types/node@24.19.2) packages: @@ -730,6 +733,9 @@ packages: '@types/geojson@7946.0.16': resolution: {integrity: sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==} + '@types/node@24.19.2': + resolution: {integrity: sha512-93d49wCWJkCyN87MxLpNN6KXPCwFw7bVUg79mGUV1OS40JGWwVCr8n61DXCSqz7CV6/VfPkb7xec7uP2M+QHWQ==} + '@types/trusted-types@2.0.7': resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==} @@ -1321,6 +1327,9 @@ packages: uc.micro@3.0.0: resolution: {integrity: sha512-U3PppEkleoTnIfi8BozMx3yju3qc/L6SwqWo2Sw+54PX+PX0q9I+r1Um5HCmqD7n9VDX5/v3vQH/AjA6deDdtw==} + undici-types@7.24.6: + resolution: {integrity: sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==} + uuid@14.0.2: resolution: {integrity: sha512-xZe/16rV4aa+HGSOCiY2YeLT1OybRLrrkL/Rqaq7p7GMVXjFh+6wN4oMYgjFmnSnhY8t6Xpdl2l9qmnHYuMHwQ==} hasBin: true @@ -1617,15 +1626,15 @@ snapshots: dependencies: acorn: 8.18.0 - '@sveltejs/adapter-static@3.0.10(@sveltejs/kit@2.70.3(@sveltejs/vite-plugin-svelte@7.3.0(svelte@5.57.1)(vite@8.3.0))(svelte@5.57.1)(typescript@6.0.3)(vite@8.3.0))': + '@sveltejs/adapter-static@3.0.10(@sveltejs/kit@2.70.3(@sveltejs/vite-plugin-svelte@7.3.0(svelte@5.57.1)(vite@8.3.0(@types/node@24.19.2)))(svelte@5.57.1)(typescript@6.0.3)(vite@8.3.0(@types/node@24.19.2)))': dependencies: - '@sveltejs/kit': 2.70.3(@sveltejs/vite-plugin-svelte@7.3.0(svelte@5.57.1)(vite@8.3.0))(svelte@5.57.1)(typescript@6.0.3)(vite@8.3.0) + '@sveltejs/kit': 2.70.3(@sveltejs/vite-plugin-svelte@7.3.0(svelte@5.57.1)(vite@8.3.0(@types/node@24.19.2)))(svelte@5.57.1)(typescript@6.0.3)(vite@8.3.0(@types/node@24.19.2)) - '@sveltejs/kit@2.70.3(@sveltejs/vite-plugin-svelte@7.3.0(svelte@5.57.1)(vite@8.3.0))(svelte@5.57.1)(typescript@6.0.3)(vite@8.3.0)': + '@sveltejs/kit@2.70.3(@sveltejs/vite-plugin-svelte@7.3.0(svelte@5.57.1)(vite@8.3.0(@types/node@24.19.2)))(svelte@5.57.1)(typescript@6.0.3)(vite@8.3.0(@types/node@24.19.2))': dependencies: '@standard-schema/spec': 1.1.0 '@sveltejs/acorn-typescript': 1.0.13(acorn@8.18.0) - '@sveltejs/vite-plugin-svelte': 7.3.0(svelte@5.57.1)(vite@8.3.0) + '@sveltejs/vite-plugin-svelte': 7.3.0(svelte@5.57.1)(vite@8.3.0(@types/node@24.19.2)) '@types/cookie': 0.6.0 acorn: 8.18.0 cookie: 0.6.0 @@ -1637,20 +1646,20 @@ snapshots: set-cookie-parser: 3.1.2 sirv: 3.0.2 svelte: 5.57.1 - vite: 8.3.0 + vite: 8.3.0(@types/node@24.19.2) optionalDependencies: typescript: 6.0.3 '@sveltejs/load-config@0.2.3': {} - '@sveltejs/vite-plugin-svelte@7.3.0(svelte@5.57.1)(vite@8.3.0)': + '@sveltejs/vite-plugin-svelte@7.3.0(svelte@5.57.1)(vite@8.3.0(@types/node@24.19.2))': dependencies: deepmerge: 4.3.1 magic-string: 1.4.1 obug: 2.2.1 svelte: 5.57.1 - vite: 8.3.0 - vitefu: 1.1.3(vite@8.3.0) + vite: 8.3.0(@types/node@24.19.2) + vitefu: 1.1.3(vite@8.3.0(@types/node@24.19.2)) '@tauri-apps/api@2.11.1': {} @@ -2017,6 +2026,10 @@ snapshots: '@types/geojson@7946.0.16': {} + '@types/node@24.19.2': + dependencies: + undici-types: 7.24.6 + '@types/trusted-types@2.0.7': optional: true @@ -2641,9 +2654,11 @@ snapshots: uc.micro@3.0.0: {} + undici-types@7.24.6: {} + uuid@14.0.2: {} - vite@8.3.0: + vite@8.3.0(@types/node@24.19.2): dependencies: lightningcss: 1.33.0 picomatch: 4.0.7 @@ -2651,11 +2666,12 @@ snapshots: rolldown: 1.2.9 tinyglobby: 0.2.17 optionalDependencies: + '@types/node': 24.19.2 fsevents: 2.3.3 - vitefu@1.1.3(vite@8.3.0): + vitefu@1.1.3(vite@8.3.0(@types/node@24.19.2)): optionalDependencies: - vite: 8.3.0 + vite: 8.3.0(@types/node@24.19.2) w3c-keyname@2.2.8: {} diff --git a/scripts/pluginMocks.mjs b/scripts/pluginMocks.mjs index a89d591..4df91d9 100644 --- a/scripts/pluginMocks.mjs +++ b/scripts/pluginMocks.mjs @@ -1,40 +1,2 @@ -import { readFile } from "node:fs/promises"; -import { resolve } from "node:path"; -import { pathToFileURL } from "node:url"; - -/** Load the actual compiled packages through the production Blob module loader. */ -export async function mockFeaturePlugins(surface) { - const packages = await Promise.all(["terminal", "table-formulas"].map(async name => { - const root = name === "terminal" - ? (process.env.RUNESTONE_TERMINAL_DIST ? pathToFileURL(resolve(process.env.RUNESTONE_TERMINAL_DIST) + "/") : new URL("../../RuneStone_Terminal/dist/", import.meta.url)) - : new URL(`../plugin-packages/${name}/`, import.meta.url); - return { - manifest: JSON.parse(await readFile(new URL("plugin.json", root), "utf8")), - code: await readFile(new URL("main.js", root), "utf8"), - css: name === "terminal" ? await readFile(new URL("style.css", root), "base64") : "", - }; - })); - await surface.addInitScript(packages => { - const key = "test.installed-plugins"; - const root = "C:\\AppData\\RuneStone\\plugins"; - const defaults = packages.map(item => ({ manifest: item.manifest, hash: "test-hash", enabled: true, path: root + "\\" + item.manifest.id, error: null, removal: false })); - const read = () => JSON.parse(localStorage.getItem(key) || JSON.stringify(defaults)); - const write = rows => { localStorage.setItem(key, JSON.stringify(rows)); window.__TEST__?.emit("plugins-changed", {}); }; - if (!localStorage.getItem(key)) localStorage.setItem(key, JSON.stringify(defaults)); - window.addEventListener("storage", event => { if (event.key === key) window.__TEST__?.emit("plugins-changed", {}); }); - const original = window.__TAURI_INTERNALS__.invoke; - window.__TAURI_INTERNALS__.invoke = async (command, args = {}) => { - if (!command.startsWith("plugins_")) return original(command, args); - window.__TEST__?.calls.push({ command, args }); - if (command === "plugins_snapshot") return { root, plugins: read() }; - if (command === "plugins_load") return packages.find(item => item.manifest.id === args.id).code; - if (command === "plugins_asset") return packages.find(item => item.manifest.id === args.id).css; - if (command === "plugins_set_enabled") { write(read().map(item => item.manifest.id === args.id ? { ...item, enabled: args.enabled } : item)); return; } - if (command === "plugins_prepare_remove") return { token: args.id, plugin: read().find(item => item.manifest.id === args.id) }; - if (command === "plugins_remove") { write(read().filter(item => item.manifest.id !== args.token)); return; } - if (command === "plugins_data") return "null"; - if (["plugins_release", "plugins_cancel", "plugins_reveal"].includes(command)) return; - throw new Error(`Unhandled plugin IPC: ${command}`); - }; - }, packages); -} +// RuneStone_Terminal imports this path for its smoke test. The helper lives in the shared smoke harness. +export * from "../tests/smoke/_harness/pluginMocks.mjs"; diff --git a/scripts/browserNativeAcceptance.mjs b/tests/native/browser.native.mjs similarity index 100% rename from scripts/browserNativeAcceptance.mjs rename to tests/native/browser.native.mjs diff --git a/scripts/nativeMenuScope.smoke.mjs b/tests/native/menuScope.native.mjs similarity index 100% rename from scripts/nativeMenuScope.smoke.mjs rename to tests/native/menuScope.native.mjs diff --git a/scripts/spellingNative.smoke.mjs b/tests/native/spelling.native.mjs similarity index 100% rename from scripts/spellingNative.smoke.mjs rename to tests/native/spelling.native.mjs diff --git a/scripts/kanbanNative.smoke.mjs b/tests/native/tabTransferAndThemeExport.native.mjs similarity index 100% rename from scripts/kanbanNative.smoke.mjs rename to tests/native/tabTransferAndThemeExport.native.mjs diff --git a/scripts/hostNavigationPass3.native.mjs b/tests/native/treeRename.native.mjs similarity index 100% rename from scripts/hostNavigationPass3.native.mjs rename to tests/native/treeRename.native.mjs diff --git a/tests/smoke/_harness/pluginMocks.mjs b/tests/smoke/_harness/pluginMocks.mjs new file mode 100644 index 0000000..bbf0855 --- /dev/null +++ b/tests/smoke/_harness/pluginMocks.mjs @@ -0,0 +1,40 @@ +import { readFile } from "node:fs/promises"; +import { resolve } from "node:path"; +import { pathToFileURL } from "node:url"; + +/** Load the actual compiled packages through the production Blob module loader. */ +export async function mockFeaturePlugins(surface) { + const packages = await Promise.all(["terminal", "table-formulas"].map(async name => { + const root = name === "terminal" + ? (process.env.RUNESTONE_TERMINAL_DIST ? pathToFileURL(resolve(process.env.RUNESTONE_TERMINAL_DIST) + "/") : new URL("../../../../RuneStone_Terminal/dist/", import.meta.url)) + : new URL(`../../../plugin-packages/${name}/`, import.meta.url); + return { + manifest: JSON.parse(await readFile(new URL("plugin.json", root), "utf8")), + code: await readFile(new URL("main.js", root), "utf8"), + css: name === "terminal" ? await readFile(new URL("style.css", root), "base64") : "", + }; + })); + await surface.addInitScript(packages => { + const key = "test.installed-plugins"; + const root = "C:\\AppData\\RuneStone\\plugins"; + const defaults = packages.map(item => ({ manifest: item.manifest, hash: "test-hash", enabled: true, path: root + "\\" + item.manifest.id, error: null, removal: false })); + const read = () => JSON.parse(localStorage.getItem(key) || JSON.stringify(defaults)); + const write = rows => { localStorage.setItem(key, JSON.stringify(rows)); window.__TEST__?.emit("plugins-changed", {}); }; + if (!localStorage.getItem(key)) localStorage.setItem(key, JSON.stringify(defaults)); + window.addEventListener("storage", event => { if (event.key === key) window.__TEST__?.emit("plugins-changed", {}); }); + const original = window.__TAURI_INTERNALS__.invoke; + window.__TAURI_INTERNALS__.invoke = async (command, args = {}) => { + if (!command.startsWith("plugins_")) return original(command, args); + window.__TEST__?.calls.push({ command, args }); + if (command === "plugins_snapshot") return { root, plugins: read() }; + if (command === "plugins_load") return packages.find(item => item.manifest.id === args.id).code; + if (command === "plugins_asset") return packages.find(item => item.manifest.id === args.id).css; + if (command === "plugins_set_enabled") { write(read().map(item => item.manifest.id === args.id ? { ...item, enabled: args.enabled } : item)); return; } + if (command === "plugins_prepare_remove") return { token: args.id, plugin: read().find(item => item.manifest.id === args.id) }; + if (command === "plugins_remove") { write(read().filter(item => item.manifest.id !== args.token)); return; } + if (command === "plugins_data") return "null"; + if (["plugins_release", "plugins_cancel", "plugins_reveal"].includes(command)) return; + throw new Error(`Unhandled plugin IPC: ${command}`); + }; + }, packages); +} diff --git a/scripts/backgroundFrames.smoke.mjs b/tests/smoke/appearance/backgroundFrames.smoke.mjs similarity index 100% rename from scripts/backgroundFrames.smoke.mjs rename to tests/smoke/appearance/backgroundFrames.smoke.mjs diff --git a/scripts/appearancePass3.smoke.mjs b/tests/smoke/appearance/backgroundImages.smoke.mjs similarity index 100% rename from scripts/appearancePass3.smoke.mjs rename to tests/smoke/appearance/backgroundImages.smoke.mjs diff --git a/scripts/backgroundLayout.smoke.mjs b/tests/smoke/appearance/backgroundLayout.smoke.mjs similarity index 100% rename from scripts/backgroundLayout.smoke.mjs rename to tests/smoke/appearance/backgroundLayout.smoke.mjs diff --git a/scripts/overlayPercentage.smoke.mjs b/tests/smoke/appearance/backgroundOverlay.smoke.mjs similarity index 100% rename from scripts/overlayPercentage.smoke.mjs rename to tests/smoke/appearance/backgroundOverlay.smoke.mjs diff --git a/scripts/characterThemes.smoke.mjs b/tests/smoke/appearance/characterThemes.smoke.mjs similarity index 100% rename from scripts/characterThemes.smoke.mjs rename to tests/smoke/appearance/characterThemes.smoke.mjs diff --git a/scripts/uiDensity.smoke.mjs b/tests/smoke/appearance/density.smoke.mjs similarity index 100% rename from scripts/uiDensity.smoke.mjs rename to tests/smoke/appearance/density.smoke.mjs diff --git a/scripts/appearance.smoke.mjs b/tests/smoke/appearance/palettes.smoke.mjs similarity index 100% rename from scripts/appearance.smoke.mjs rename to tests/smoke/appearance/palettes.smoke.mjs diff --git a/scripts/hostAppearance.smoke.mjs b/tests/smoke/appearance/themeVariants.smoke.mjs similarity index 100% rename from scripts/hostAppearance.smoke.mjs rename to tests/smoke/appearance/themeVariants.smoke.mjs diff --git a/scripts/october15Appearance.smoke.mjs b/tests/smoke/appearance/tooltipsAndSelection.smoke.mjs similarity index 100% rename from scripts/october15Appearance.smoke.mjs rename to tests/smoke/appearance/tooltipsAndSelection.smoke.mjs diff --git a/scripts/themeTypography.smoke.mjs b/tests/smoke/appearance/typography.smoke.mjs similarity index 100% rename from scripts/themeTypography.smoke.mjs rename to tests/smoke/appearance/typography.smoke.mjs diff --git a/scripts/builtinBrowser.smoke.mjs b/tests/smoke/browser/builtin.smoke.mjs similarity index 100% rename from scripts/builtinBrowser.smoke.mjs rename to tests/smoke/browser/builtin.smoke.mjs diff --git a/scripts/browserFields.smoke.mjs b/tests/smoke/browser/fields.smoke.mjs similarity index 100% rename from scripts/browserFields.smoke.mjs rename to tests/smoke/browser/fields.smoke.mjs diff --git a/scripts/browserInteraction.smoke.mjs b/tests/smoke/browser/interaction.smoke.mjs similarity index 100% rename from scripts/browserInteraction.smoke.mjs rename to tests/smoke/browser/interaction.smoke.mjs diff --git a/scripts/browserSettingsMenus.smoke.mjs b/tests/smoke/browser/settingsMenus.smoke.mjs similarity index 100% rename from scripts/browserSettingsMenus.smoke.mjs rename to tests/smoke/browser/settingsMenus.smoke.mjs diff --git a/scripts/browserWebData.smoke.mjs b/tests/smoke/browser/webData.smoke.mjs similarity index 100% rename from scripts/browserWebData.smoke.mjs rename to tests/smoke/browser/webData.smoke.mjs diff --git a/scripts/editorClipboardChecklist.smoke.mjs b/tests/smoke/editor/checklistEntry.smoke.mjs similarity index 100% rename from scripts/editorClipboardChecklist.smoke.mjs rename to tests/smoke/editor/checklistEntry.smoke.mjs diff --git a/scripts/codeBlocks.smoke.mjs b/tests/smoke/editor/codeBlocks.smoke.mjs similarity index 100% rename from scripts/codeBlocks.smoke.mjs rename to tests/smoke/editor/codeBlocks.smoke.mjs diff --git a/scripts/dividers.smoke.mjs b/tests/smoke/editor/dividers.smoke.mjs similarity index 100% rename from scripts/dividers.smoke.mjs rename to tests/smoke/editor/dividers.smoke.mjs diff --git a/scripts/editorEmptyMenu.smoke.mjs b/tests/smoke/editor/emptyMenu.smoke.mjs similarity index 100% rename from scripts/editorEmptyMenu.smoke.mjs rename to tests/smoke/editor/emptyMenu.smoke.mjs diff --git a/scripts/editorOctober12.smoke.mjs b/tests/smoke/editor/footnotes.smoke.mjs similarity index 100% rename from scripts/editorOctober12.smoke.mjs rename to tests/smoke/editor/footnotes.smoke.mjs diff --git a/scripts/imageNavigation.smoke.mjs b/tests/smoke/editor/imageNavigation.smoke.mjs similarity index 100% rename from scripts/imageNavigation.smoke.mjs rename to tests/smoke/editor/imageNavigation.smoke.mjs diff --git a/scripts/images.smoke.mjs b/tests/smoke/editor/images.smoke.mjs similarity index 100% rename from scripts/images.smoke.mjs rename to tests/smoke/editor/images.smoke.mjs diff --git a/scripts/editorInteractions.smoke.mjs b/tests/smoke/editor/interactions.smoke.mjs similarity index 100% rename from scripts/editorInteractions.smoke.mjs rename to tests/smoke/editor/interactions.smoke.mjs diff --git a/scripts/markdownMenu.smoke.mjs b/tests/smoke/editor/markdownMenu.smoke.mjs similarity index 99% rename from scripts/markdownMenu.smoke.mjs rename to tests/smoke/editor/markdownMenu.smoke.mjs index 6c705ca..362ec90 100644 --- a/scripts/markdownMenu.smoke.mjs +++ b/tests/smoke/editor/markdownMenu.smoke.mjs @@ -8,7 +8,7 @@ const browser = await chromium.launch({ headless: true, ...(process.env.CHROME_P const page = await browser.newPage({ viewport: { width: 1440, height: 1000 } }); page.setDefaultTimeout(10000); const errors = []; -const showcase = await readFile(new URL("../fixtures/reader-showcase.md", import.meta.url), "utf8"); +const showcase = await readFile(new URL("../../../fixtures/reader-showcase.md", import.meta.url), "utf8"); page.on("console", message => { if (message.type() === "error" || message.type() === "warning") console.log(message.type(), message.text()); }); page.on("pageerror", error => errors.push(error.message)); await page.addInitScript(() => { diff --git a/scripts/markdownPaste.smoke.mjs b/tests/smoke/editor/markdownPaste.smoke.mjs similarity index 100% rename from scripts/markdownPaste.smoke.mjs rename to tests/smoke/editor/markdownPaste.smoke.mjs diff --git a/scripts/pasteRepeat.smoke.mjs b/tests/smoke/editor/pasteRepeat.smoke.mjs similarity index 100% rename from scripts/pasteRepeat.smoke.mjs rename to tests/smoke/editor/pasteRepeat.smoke.mjs diff --git a/scripts/propertiesInitial.smoke.mjs b/tests/smoke/editor/properties.smoke.mjs similarity index 100% rename from scripts/propertiesInitial.smoke.mjs rename to tests/smoke/editor/properties.smoke.mjs diff --git a/scripts/editorSurfaces.smoke.mjs b/tests/smoke/editor/surfaces.smoke.mjs similarity index 100% rename from scripts/editorSurfaces.smoke.mjs rename to tests/smoke/editor/surfaces.smoke.mjs diff --git a/scripts/editorTemplateHyphen.smoke.mjs b/tests/smoke/editor/templatesAndTasks.smoke.mjs similarity index 100% rename from scripts/editorTemplateHyphen.smoke.mjs rename to tests/smoke/editor/templatesAndTasks.smoke.mjs diff --git a/scripts/undoHistory.smoke.mjs b/tests/smoke/editor/undoHistory.smoke.mjs similarity index 100% rename from scripts/undoHistory.smoke.mjs rename to tests/smoke/editor/undoHistory.smoke.mjs diff --git a/scripts/unifiedFind.smoke.mjs b/tests/smoke/find/documentFind.smoke.mjs similarity index 100% rename from scripts/unifiedFind.smoke.mjs rename to tests/smoke/find/documentFind.smoke.mjs diff --git a/scripts/pluginFind.smoke.mjs b/tests/smoke/find/pluginViews.smoke.mjs similarity index 97% rename from scripts/pluginFind.smoke.mjs rename to tests/smoke/find/pluginViews.smoke.mjs index e47acca..edd4b03 100644 --- a/scripts/pluginFind.smoke.mjs +++ b/tests/smoke/find/pluginViews.smoke.mjs @@ -12,8 +12,8 @@ page.on('pageerror', error => errors.push(error.message)); const output = '.audit/host-privacy-find'; await mkdir(output, { recursive: true }); const pm = { - manifest: JSON.parse(await readFile(new URL('../../RuneStone_Project_Management/dist/plugin/plugin.json', import.meta.url), 'utf8')), - code: await readFile(new URL('../../RuneStone_Project_Management/dist/plugin/main.js', import.meta.url), 'utf8'), + manifest: JSON.parse(await readFile(new URL('../../../../RuneStone_Project_Management/dist/plugin/plugin.json', import.meta.url), 'utf8')), + code: await readFile(new URL('../../../../RuneStone_Project_Management/dist/plugin/main.js', import.meta.url), 'utf8'), }; await page.addInitScript(({ pm }) => { window.isTauri = true; diff --git a/scripts/find.smoke.mjs b/tests/smoke/find/searchPanel.smoke.mjs similarity index 100% rename from scripts/find.smoke.mjs rename to tests/smoke/find/searchPanel.smoke.mjs diff --git a/scripts/workbenchLayout.smoke.mjs b/tests/smoke/layout/outline.smoke.mjs similarity index 100% rename from scripts/workbenchLayout.smoke.mjs rename to tests/smoke/layout/outline.smoke.mjs diff --git a/scripts/documentSplits.smoke.mjs b/tests/smoke/layout/splits.smoke.mjs similarity index 100% rename from scripts/documentSplits.smoke.mjs rename to tests/smoke/layout/splits.smoke.mjs diff --git a/scripts/windowControls.smoke.mjs b/tests/smoke/layout/windowControls.smoke.mjs similarity index 95% rename from scripts/windowControls.smoke.mjs rename to tests/smoke/layout/windowControls.smoke.mjs index 3f4cc0e..3d60c5e 100644 --- a/scripts/windowControls.smoke.mjs +++ b/tests/smoke/layout/windowControls.smoke.mjs @@ -39,9 +39,9 @@ await page.addInitScript(() => { window.__TEST__ = { state, emit }; }); try { - const config = JSON.parse(await readFile(new URL("../src-tauri/tauri.conf.json", import.meta.url), "utf8")); + const config = JSON.parse(await readFile(new URL("../../../src-tauri/tauri.conf.json", import.meta.url), "utf8")); assert.equal(config.app.windows[0].decorations, false); - const capability = JSON.parse(await readFile(new URL("../src-tauri/capabilities/default.json", import.meta.url), "utf8")); + const capability = JSON.parse(await readFile(new URL("../../../src-tauri/capabilities/default.json", import.meta.url), "utf8")); for (const permission of ["close", "minimize", "toggle-maximize", "start-dragging"]) { assert.ok(capability.permissions.includes(`core:window:allow-${permission}`)); } diff --git a/scripts/workbench.smoke.mjs b/tests/smoke/layout/workbench.smoke.mjs similarity index 99% rename from scripts/workbench.smoke.mjs rename to tests/smoke/layout/workbench.smoke.mjs index e786cdc..4cf2383 100644 --- a/scripts/workbench.smoke.mjs +++ b/tests/smoke/layout/workbench.smoke.mjs @@ -1,4 +1,4 @@ -import { mockFeaturePlugins } from "./pluginMocks.mjs"; +import { mockFeaturePlugins } from "../_harness/pluginMocks.mjs"; // Run against `pnpm dev`. PLAYWRIGHT_MODULE may point to a shared installation. import { createRequire } from "node:module"; import assert from "node:assert/strict"; @@ -9,7 +9,7 @@ const browser = await chromium.launch({ headless: true, ...(process.env.CHROME_P const page = await browser.newPage({ viewport: { width: 1440, height: 1000 } }); page.setDefaultTimeout(10000); const errors = []; -const showcase = await readFile(new URL("../fixtures/reader-showcase.md", import.meta.url), "utf8"); +const showcase = await readFile(new URL("../../../fixtures/reader-showcase.md", import.meta.url), "utf8"); page.on("console", message => { if (message.type() === "error" || message.type() === "warning") console.log(message.type(), message.text()); }); page.on("pageerror", error => errors.push(error.message)); await page.addInitScript(() => { diff --git a/scripts/backlinks.smoke.mjs b/tests/smoke/links/backlinks.smoke.mjs similarity index 100% rename from scripts/backlinks.smoke.mjs rename to tests/smoke/links/backlinks.smoke.mjs diff --git a/scripts/editorLinkEditing.smoke.mjs b/tests/smoke/links/linkEditing.smoke.mjs similarity index 100% rename from scripts/editorLinkEditing.smoke.mjs rename to tests/smoke/links/linkEditing.smoke.mjs diff --git a/scripts/editorLinkMenus.smoke.mjs b/tests/smoke/links/linkMenus.smoke.mjs similarity index 100% rename from scripts/editorLinkMenus.smoke.mjs rename to tests/smoke/links/linkMenus.smoke.mjs diff --git a/scripts/editorPreviewLinks.smoke.mjs b/tests/smoke/links/previewLinks.smoke.mjs similarity index 100% rename from scripts/editorPreviewLinks.smoke.mjs rename to tests/smoke/links/previewLinks.smoke.mjs diff --git a/scripts/sectionLinks.smoke.mjs b/tests/smoke/links/sectionLinks.smoke.mjs similarity index 100% rename from scripts/sectionLinks.smoke.mjs rename to tests/smoke/links/sectionLinks.smoke.mjs diff --git a/scripts/workspaceLinks.smoke.mjs b/tests/smoke/links/workspaceLinks.smoke.mjs similarity index 100% rename from scripts/workspaceLinks.smoke.mjs rename to tests/smoke/links/workspaceLinks.smoke.mjs diff --git a/scripts/menuConsistency.smoke.mjs b/tests/smoke/menus/consistency.smoke.mjs similarity index 100% rename from scripts/menuConsistency.smoke.mjs rename to tests/smoke/menus/consistency.smoke.mjs diff --git a/scripts/pluginAccess.smoke.mjs b/tests/smoke/plugins/access.smoke.mjs similarity index 100% rename from scripts/pluginAccess.smoke.mjs rename to tests/smoke/plugins/access.smoke.mjs diff --git a/scripts/pluginChoiceMenus.smoke.mjs b/tests/smoke/plugins/choiceMenus.smoke.mjs similarity index 97% rename from scripts/pluginChoiceMenus.smoke.mjs rename to tests/smoke/plugins/choiceMenus.smoke.mjs index 5e64fa8..8ddc4c2 100644 --- a/scripts/pluginChoiceMenus.smoke.mjs +++ b/tests/smoke/plugins/choiceMenus.smoke.mjs @@ -13,7 +13,7 @@ await page.route('**/__choice-audit__', route => route.fulfill({ contentType: 't await page.route('**/__autocomplete__/*.mjs', async route => { const name = new URL(route.request().url()).pathname.split('/').pop(); assert.ok(['main.mjs', 'engine.mjs'].includes(name)); - await route.fulfill({ contentType: 'application/javascript', body: await readFile(new URL(`../../RuneStone_LocalAutocomplete/src/${name}`, import.meta.url), 'utf8') }); + await route.fulfill({ contentType: 'application/javascript', body: await readFile(new URL(`../../../../RuneStone_LocalAutocomplete/src/${name}`, import.meta.url), 'utf8') }); }); try { for (const theme of ['light', 'dark']) for (const width of [1100, 390]) { diff --git a/scripts/pluginInstall.smoke.mjs b/tests/smoke/plugins/install.smoke.mjs similarity index 100% rename from scripts/pluginInstall.smoke.mjs rename to tests/smoke/plugins/install.smoke.mjs diff --git a/scripts/plugins.smoke.mjs b/tests/smoke/plugins/lifecycle.smoke.mjs similarity index 99% rename from scripts/plugins.smoke.mjs rename to tests/smoke/plugins/lifecycle.smoke.mjs index f9677b3..c2a12d3 100644 --- a/scripts/plugins.smoke.mjs +++ b/tests/smoke/plugins/lifecycle.smoke.mjs @@ -1,4 +1,4 @@ -import { mockFeaturePlugins } from "./pluginMocks.mjs"; +import { mockFeaturePlugins } from "../_harness/pluginMocks.mjs"; // Run against `pnpm dev`. PLAYWRIGHT_MODULE may point to a shared installation. import { createRequire } from "node:module"; import assert from "node:assert/strict"; diff --git a/scripts/hostTodo.smoke.mjs b/tests/smoke/regressions/renameMarksAndTemplates.smoke.mjs similarity index 100% rename from scripts/hostTodo.smoke.mjs rename to tests/smoke/regressions/renameMarksAndTemplates.smoke.mjs diff --git a/scripts/todoUi.smoke.mjs b/tests/smoke/regressions/tooltipsAndBlankBrowser.smoke.mjs similarity index 100% rename from scripts/todoUi.smoke.mjs rename to tests/smoke/regressions/tooltipsAndBlankBrowser.smoke.mjs diff --git a/scripts/kanbanRoot.smoke.mjs b/tests/smoke/regressions/treeDragLinksAndGitToolbar.smoke.mjs similarity index 100% rename from scripts/kanbanRoot.smoke.mjs rename to tests/smoke/regressions/treeDragLinksAndGitToolbar.smoke.mjs diff --git a/scripts/kanbanWorkspace.smoke.mjs b/tests/smoke/regressions/workspaceShortcutsAndTemplates.smoke.mjs similarity index 100% rename from scripts/kanbanWorkspace.smoke.mjs rename to tests/smoke/regressions/workspaceShortcutsAndTemplates.smoke.mjs diff --git a/scripts/settingsDensity.smoke.mjs b/tests/smoke/settings/density.smoke.mjs similarity index 100% rename from scripts/settingsDensity.smoke.mjs rename to tests/smoke/settings/density.smoke.mjs diff --git a/scripts/appearanceLanguage.smoke.mjs b/tests/smoke/settings/displayLanguage.smoke.mjs similarity index 100% rename from scripts/appearanceLanguage.smoke.mjs rename to tests/smoke/settings/displayLanguage.smoke.mjs diff --git a/scripts/settings.smoke.mjs b/tests/smoke/settings/general.smoke.mjs similarity index 98% rename from scripts/settings.smoke.mjs rename to tests/smoke/settings/general.smoke.mjs index beb659a..a9c206b 100644 --- a/scripts/settings.smoke.mjs +++ b/tests/smoke/settings/general.smoke.mjs @@ -3,7 +3,7 @@ import { createRequire } from "node:module"; import { mkdirSync, readFileSync } from "node:fs"; import assert from "node:assert/strict"; const require = createRequire(import.meta.url); -const { version } = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")); +const { version } = JSON.parse(readFileSync(new URL("../../../package.json", import.meta.url), "utf8")); mkdirSync(".audit", { recursive: true }); const { chromium } = require(process.env.PLAYWRIGHT_MODULE || "playwright"); const browser = await chromium.launch({ headless: true, ...(process.env.CHROME_PATH ? { executablePath: process.env.CHROME_PATH } : {}) }); diff --git a/scripts/settingsTitlebar.smoke.mjs b/tests/smoke/settings/titlebar.smoke.mjs similarity index 97% rename from scripts/settingsTitlebar.smoke.mjs rename to tests/smoke/settings/titlebar.smoke.mjs index 9b2bae9..09d0521 100644 --- a/scripts/settingsTitlebar.smoke.mjs +++ b/tests/smoke/settings/titlebar.smoke.mjs @@ -7,7 +7,7 @@ const { chromium } = require(process.env.PLAYWRIGHT_MODULE || "playwright"); const browser = await chromium.launch({ headless: true, ...(process.env.CHROME_PATH ? { executablePath: process.env.CHROME_PATH } : {}) }); const url = process.env.SMOKE_URL || "http://127.0.0.1:1420"; mkdirSync(".audit", { recursive: true }); -const settingsCapability = JSON.parse(readFileSync(new URL("../src-tauri/capabilities/settings.json", import.meta.url), "utf8")); +const settingsCapability = JSON.parse(readFileSync(new URL("../../../src-tauri/capabilities/settings.json", import.meta.url), "utf8")); assert.deepEqual(settingsCapability.windows, ["settings-main", "settings-workspace-*"]); for (const action of ["close", "minimize", "toggle-maximize", "start-dragging"]) { assert(settingsCapability.permissions.includes(`core:window:allow-${action}`)); diff --git a/scripts/settingsWindow.smoke.mjs b/tests/smoke/settings/window.smoke.mjs similarity index 100% rename from scripts/settingsWindow.smoke.mjs rename to tests/smoke/settings/window.smoke.mjs diff --git a/scripts/tableDrag.smoke.mjs b/tests/smoke/tables/drag.smoke.mjs similarity index 100% rename from scripts/tableDrag.smoke.mjs rename to tests/smoke/tables/drag.smoke.mjs diff --git a/scripts/october15Editor.smoke.mjs b/tests/smoke/tables/enterKey.smoke.mjs similarity index 100% rename from scripts/october15Editor.smoke.mjs rename to tests/smoke/tables/enterKey.smoke.mjs diff --git a/scripts/tableFormulas.smoke.mjs b/tests/smoke/tables/formulas.smoke.mjs similarity index 99% rename from scripts/tableFormulas.smoke.mjs rename to tests/smoke/tables/formulas.smoke.mjs index 471b42c..46e53a6 100644 --- a/scripts/tableFormulas.smoke.mjs +++ b/tests/smoke/tables/formulas.smoke.mjs @@ -1,4 +1,4 @@ -import { mockFeaturePlugins } from "./pluginMocks.mjs"; +import { mockFeaturePlugins } from "../_harness/pluginMocks.mjs"; // Run against `pnpm dev`. PLAYWRIGHT_MODULE may point to a shared installation. import { createRequire } from "node:module"; import assert from "node:assert/strict"; diff --git a/scripts/tableLinkCaret.smoke.mjs b/tests/smoke/tables/linkCaret.smoke.mjs similarity index 100% rename from scripts/tableLinkCaret.smoke.mjs rename to tests/smoke/tables/linkCaret.smoke.mjs diff --git a/scripts/tableNavigation.smoke.mjs b/tests/smoke/tables/navigation.smoke.mjs similarity index 99% rename from scripts/tableNavigation.smoke.mjs rename to tests/smoke/tables/navigation.smoke.mjs index d5094c8..3d05f02 100644 --- a/scripts/tableNavigation.smoke.mjs +++ b/tests/smoke/tables/navigation.smoke.mjs @@ -1,4 +1,4 @@ -import { mockFeaturePlugins } from "./pluginMocks.mjs"; +import { mockFeaturePlugins } from "../_harness/pluginMocks.mjs"; // Run against `pnpm dev`. PLAYWRIGHT_MODULE may point to a shared installation. import { createRequire } from "node:module"; import assert from "node:assert/strict"; diff --git a/scripts/tableSelection.smoke.mjs b/tests/smoke/tables/selection.smoke.mjs similarity index 100% rename from scripts/tableSelection.smoke.mjs rename to tests/smoke/tables/selection.smoke.mjs diff --git a/scripts/pluginTabOrder.smoke.mjs b/tests/smoke/tabs/lastTabAndSiteIcons.smoke.mjs similarity index 100% rename from scripts/pluginTabOrder.smoke.mjs rename to tests/smoke/tabs/lastTabAndSiteIcons.smoke.mjs diff --git a/scripts/tabLifecycle.smoke.mjs b/tests/smoke/tabs/lifecycle.smoke.mjs similarity index 100% rename from scripts/tabLifecycle.smoke.mjs rename to tests/smoke/tabs/lifecycle.smoke.mjs diff --git a/scripts/tabMenus.smoke.mjs b/tests/smoke/tabs/menus.smoke.mjs similarity index 100% rename from scripts/tabMenus.smoke.mjs rename to tests/smoke/tabs/menus.smoke.mjs diff --git a/scripts/tabOrder.smoke.mjs b/tests/smoke/tabs/order.smoke.mjs similarity index 100% rename from scripts/tabOrder.smoke.mjs rename to tests/smoke/tabs/order.smoke.mjs diff --git a/scripts/tabRibbonDrop.smoke.mjs b/tests/smoke/tabs/ribbonDrop.smoke.mjs similarity index 100% rename from scripts/tabRibbonDrop.smoke.mjs rename to tests/smoke/tabs/ribbonDrop.smoke.mjs diff --git a/scripts/tabScroll.smoke.mjs b/tests/smoke/tabs/scroll.smoke.mjs similarity index 100% rename from scripts/tabScroll.smoke.mjs rename to tests/smoke/tabs/scroll.smoke.mjs diff --git a/scripts/tabTransfer.smoke.mjs b/tests/smoke/tabs/transfer.smoke.mjs similarity index 100% rename from scripts/tabTransfer.smoke.mjs rename to tests/smoke/tabs/transfer.smoke.mjs diff --git a/scripts/treeActions.smoke.mjs b/tests/smoke/tree/actions.smoke.mjs similarity index 100% rename from scripts/treeActions.smoke.mjs rename to tests/smoke/tree/actions.smoke.mjs diff --git a/scripts/todoNavigation.smoke.mjs b/tests/smoke/tree/navigation.smoke.mjs similarity index 100% rename from scripts/todoNavigation.smoke.mjs rename to tests/smoke/tree/navigation.smoke.mjs diff --git a/scripts/editorFiles.smoke.mjs b/tests/smoke/tree/newFiles.smoke.mjs similarity index 100% rename from scripts/editorFiles.smoke.mjs rename to tests/smoke/tree/newFiles.smoke.mjs diff --git a/scripts/renameSelection.smoke.mjs b/tests/smoke/tree/renameSelection.smoke.mjs similarity index 100% rename from scripts/renameSelection.smoke.mjs rename to tests/smoke/tree/renameSelection.smoke.mjs diff --git a/scripts/renameTitle.smoke.mjs b/tests/smoke/tree/renameTitle.smoke.mjs similarity index 100% rename from scripts/renameTitle.smoke.mjs rename to tests/smoke/tree/renameTitle.smoke.mjs diff --git a/scripts/hostNavigationPass3.smoke.mjs b/tests/smoke/tree/renameUndo.smoke.mjs similarity index 99% rename from scripts/hostNavigationPass3.smoke.mjs rename to tests/smoke/tree/renameUndo.smoke.mjs index 1249f3f..2669eed 100644 --- a/scripts/hostNavigationPass3.smoke.mjs +++ b/tests/smoke/tree/renameUndo.smoke.mjs @@ -8,7 +8,7 @@ const context = await browser.newContext({ viewport: { width: 1200, height: 850 const page = await context.newPage(); const errors = []; page.on('pageerror', error => errors.push(error.message)); -const gitRoot = new URL('../../RuneStone_Git/dist/', import.meta.url); +const gitRoot = new URL('../../../../RuneStone_Git/dist/', import.meta.url); const git = { manifest: JSON.parse(await readFile(new URL('plugin.json', gitRoot), 'utf8')), code: await readFile(new URL('main.js', gitRoot), 'utf8'), diff --git a/scripts/treeSelection.smoke.mjs b/tests/smoke/tree/selection.smoke.mjs similarity index 100% rename from scripts/treeSelection.smoke.mjs rename to tests/smoke/tree/selection.smoke.mjs diff --git a/scripts/workspaces.smoke.mjs b/tests/smoke/workspace/openAndCreate.smoke.mjs similarity index 100% rename from scripts/workspaces.smoke.mjs rename to tests/smoke/workspace/openAndCreate.smoke.mjs diff --git a/tests/tsconfig.json b/tests/tsconfig.json new file mode 100644 index 0000000..c0825df --- /dev/null +++ b/tests/tsconfig.json @@ -0,0 +1,11 @@ +{ + // Type checks for the unit tests. They run in Node with --experimental-strip-types. + "extends": "../tsconfig.json", + "compilerOptions": { + // The TipTap packages declare the editor commands that src/lib/editor/writerMenu.ts uses. + "types": ["node", "@tiptap/starter-kit", "@tiptap/extension-highlight", "@tiptap/extension-table", "@tiptap/extension-task-list"], + "checkJs": false + }, + "include": ["unit/**/*.ts", "../src/**/*.d.ts"], + "exclude": [] +} diff --git a/scripts/browserPlugin.spec.ts b/tests/unit/browser/browserPlugin.spec.ts similarity index 91% rename from scripts/browserPlugin.spec.ts rename to tests/unit/browser/browserPlugin.spec.ts index 836d3cc..ed658a9 100644 --- a/scripts/browserPlugin.spec.ts +++ b/tests/unit/browser/browserPlugin.spec.ts @@ -1,8 +1,8 @@ import test from "node:test"; import assert from "node:assert/strict"; -import { ContributionRegistry } from "../src/lib/plugins/registry.ts"; -import { ExternalSession } from "../src/lib/plugins/externalSession.ts"; -import type { PluginApi } from "../src/lib/plugins/sdk.ts"; +import { ContributionRegistry } from "../../../src/lib/plugins/registry.ts"; +import { ExternalSession } from "../../../src/lib/plugins/externalSession.ts"; +import type { PluginApi } from "../../../src/lib/plugins/sdk.ts"; test("browser contributions and view updates are revoked when the plugin stops", async () => { const registry = new ContributionRegistry(); diff --git a/scripts/documentFind.spec.ts b/tests/unit/editor/documentFind.spec.ts similarity index 93% rename from scripts/documentFind.spec.ts rename to tests/unit/editor/documentFind.spec.ts index ed7f3bb..effd56d 100644 --- a/scripts/documentFind.spec.ts +++ b/tests/unit/editor/documentFind.spec.ts @@ -1,7 +1,7 @@ import test from "node:test"; import assert from "node:assert/strict"; import { SearchQuery } from "@codemirror/search"; -import { documentMatches, replacementText } from "../src/lib/editor/findTarget.ts"; +import { documentMatches, replacementText } from "../../../src/lib/editor/findTarget.ts"; test("document search uses Writer word matching and normalized CRLF positions", () => { const query = new SearchQuery({ search: "Alpha", wholeWord: true, caseSensitive: true }); diff --git a/scripts/editorOctober12.spec.ts b/tests/unit/editor/footnotes.spec.ts similarity index 94% rename from scripts/editorOctober12.spec.ts rename to tests/unit/editor/footnotes.spec.ts index eb806ca..df89901 100644 --- a/scripts/editorOctober12.spec.ts +++ b/tests/unit/editor/footnotes.spec.ts @@ -1,7 +1,7 @@ import assert from "node:assert/strict"; import test from "node:test"; import MarkdownIt from "markdown-it"; -import { footnotes, renderFootnotes } from "../src/lib/editor/footnotes.ts"; +import { footnotes, renderFootnotes } from "../../../src/lib/editor/footnotes.ts"; function render(source: string) { const markdown = new MarkdownIt({ html: false }).use(footnotes); diff --git a/scripts/headingMarks.spec.ts b/tests/unit/editor/headingMarks.spec.ts similarity index 83% rename from scripts/headingMarks.spec.ts rename to tests/unit/editor/headingMarks.spec.ts index 53ca610..091e613 100644 --- a/scripts/headingMarks.spec.ts +++ b/tests/unit/editor/headingMarks.spec.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import test from "node:test"; -import { fenceOpenText, headingMarkText } from "../src/lib/editor/headingMarks.ts"; +import { fenceOpenText, headingMarkText } from "../../../src/lib/editor/headingMarks.ts"; test("heading marks match the heading level", () => { assert.equal(headingMarkText(1), "#"); diff --git a/scripts/htmlClipboard.spec.ts b/tests/unit/editor/htmlClipboard.spec.ts similarity index 92% rename from scripts/htmlClipboard.spec.ts rename to tests/unit/editor/htmlClipboard.spec.ts index 39964d2..50e70d5 100644 --- a/scripts/htmlClipboard.spec.ts +++ b/tests/unit/editor/htmlClipboard.spec.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import test from "node:test"; -import { htmlToMarkdown } from "../src/lib/workspace/htmlToMarkdown.ts"; +import { htmlToMarkdown } from "../../../src/lib/workspace/htmlToMarkdown.ts"; test("Windows HTML clipboard fragment comments do not become table content", () => { const html = '
TickerName
ADBE.USAdobe
ADSK.USAutodesk
'; diff --git a/scripts/images.spec.ts b/tests/unit/editor/images.spec.ts similarity index 94% rename from scripts/images.spec.ts rename to tests/unit/editor/images.spec.ts index f013a33..988c25b 100644 --- a/scripts/images.spec.ts +++ b/tests/unit/editor/images.spec.ts @@ -1,9 +1,9 @@ import assert from "node:assert/strict"; import test from "node:test"; import { EditorState } from "@codemirror/state"; -import { attachmentRel, hasFileDrag, imageFiles, imageInsertion, workspaceImageLink } from "../src/lib/workspace/media.ts"; -import { imageSource, editImageSource, imageSourceRanges } from "../src/lib/editor/imageSource.ts"; -import { imageDrops, trackImageDrop } from "../src/lib/editor/imageDrop.ts"; +import { attachmentRel, hasFileDrag, imageFiles, imageInsertion, workspaceImageLink } from "../../../src/lib/workspace/media.ts"; +import { imageSource, editImageSource, imageSourceRanges } from "../../../src/lib/editor/imageSource.ts"; +import { imageDrops, trackImageDrop } from "../../../src/lib/editor/imageDrop.ts"; test("same-name image imports receive distinct safe attachment paths", () => { const paths = new Set(Array.from({ length: 100 }, () => attachmentRel("photo (1).PNG"))); diff --git a/scripts/inlineMath.spec.ts b/tests/unit/editor/inlineMath.spec.ts similarity index 94% rename from scripts/inlineMath.spec.ts rename to tests/unit/editor/inlineMath.spec.ts index 100f500..56c20d7 100644 --- a/scripts/inlineMath.spec.ts +++ b/tests/unit/editor/inlineMath.spec.ts @@ -1,8 +1,8 @@ import assert from "node:assert/strict"; import test from "node:test"; import { markdown, markdownLanguage } from "@codemirror/lang-markdown"; -import { noteFormats } from "../src/lib/editor/noteFormats.ts"; -import { renderMarkdownHtml } from "../src/lib/workspace/noteHtml.ts"; +import { noteFormats } from "../../../src/lib/editor/noteFormats.ts"; +import { renderMarkdownHtml } from "../../../src/lib/workspace/noteHtml.ts"; const parser = markdown({ base: markdownLanguage, extensions: [noteFormats] }).language.parser; const render = (source: string) => renderMarkdownHtml(source, new Map()); diff --git a/scripts/languageFor.spec.ts b/tests/unit/editor/languageFor.spec.ts similarity index 89% rename from scripts/languageFor.spec.ts rename to tests/unit/editor/languageFor.spec.ts index fbf9284..aa39a8e 100644 --- a/scripts/languageFor.spec.ts +++ b/tests/unit/editor/languageFor.spec.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import test from "node:test"; -import { languageFor } from "../src/lib/editor/languageFor.ts"; +import { languageFor } from "../../../src/lib/editor/languageFor.ts"; test("markdown files use the markdown language", () => { assert.equal(languageFor("notes/inbox.md"), "markdown"); diff --git a/scripts/markdownBlocks.spec.ts b/tests/unit/editor/markdownBlocks.spec.ts similarity index 95% rename from scripts/markdownBlocks.spec.ts rename to tests/unit/editor/markdownBlocks.spec.ts index 6ddf410..dd59b2c 100644 --- a/scripts/markdownBlocks.spec.ts +++ b/tests/unit/editor/markdownBlocks.spec.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import test from "node:test"; -import { markdownBlocks, markdownFences } from "../src/lib/workspace/markdownBlocks.ts"; +import { markdownBlocks, markdownFences } from "../../../src/lib/workspace/markdownBlocks.ts"; test("fenced block with a language is one fence", () => { assert.deepEqual(markdownBlocks("hi\n```js\nconst x = 1\n```\nbye"), [ diff --git a/scripts/markdownCommands.spec.ts b/tests/unit/editor/markdownCommands.spec.ts similarity index 98% rename from scripts/markdownCommands.spec.ts rename to tests/unit/editor/markdownCommands.spec.ts index 8fef83d..eac5101 100644 --- a/scripts/markdownCommands.spec.ts +++ b/tests/unit/editor/markdownCommands.spec.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import test from "node:test"; -import { formatText, paragraphText, insertBlock, type MarkdownEdit, type InlineFormat } from "../src/lib/editor/markdownCommands.ts"; +import { formatText, paragraphText, insertBlock, type MarkdownEdit, type InlineFormat } from "../../../src/lib/editor/markdownCommands.ts"; const apply = (source: string, edit: MarkdownEdit) => source.slice(0, edit.from) + edit.insert + source.slice(edit.to); diff --git a/scripts/media.spec.ts b/tests/unit/editor/media.spec.ts similarity index 96% rename from scripts/media.spec.ts rename to tests/unit/editor/media.spec.ts index 9f9aec2..575811a 100644 --- a/scripts/media.spec.ts +++ b/tests/unit/editor/media.spec.ts @@ -5,7 +5,7 @@ import { isImagePath, isRemoteImage, resolveImageRel, -} from "../src/lib/workspace/media.ts"; +} from "../../../src/lib/workspace/media.ts"; test("image paths are detected by extension", () => { assert.equal(isImagePath("screenshot.png"), true); diff --git a/scripts/noteHtml.spec.ts b/tests/unit/editor/noteHtml.spec.ts similarity index 96% rename from scripts/noteHtml.spec.ts rename to tests/unit/editor/noteHtml.spec.ts index 0c50f50..f920eb6 100644 --- a/scripts/noteHtml.spec.ts +++ b/tests/unit/editor/noteHtml.spec.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import test from "node:test"; -import { htmlToMarkdown } from "../src/lib/workspace/htmlToMarkdown.ts"; +import { htmlToMarkdown } from "../../../src/lib/workspace/htmlToMarkdown.ts"; test("headings and inline marks become markdown", () => { const html = diff --git a/scripts/reader.spec.ts b/tests/unit/editor/reader.spec.ts similarity index 99% rename from scripts/reader.spec.ts rename to tests/unit/editor/reader.spec.ts index a48bb24..f37e8ff 100644 --- a/scripts/reader.spec.ts +++ b/tests/unit/editor/reader.spec.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import test from "node:test"; -import { markdownImages, renderMarkdownHtml, renderMarkdownSections } from "../src/lib/workspace/noteHtml.ts"; +import { markdownImages, renderMarkdownHtml, renderMarkdownSections } from "../../../src/lib/workspace/noteHtml.ts"; const render = (text: string) => renderMarkdownHtml(text, new Map()); diff --git a/scripts/writerMenu.spec.ts b/tests/unit/editor/writerMenu.spec.ts similarity index 99% rename from scripts/writerMenu.spec.ts rename to tests/unit/editor/writerMenu.spec.ts index 43112be..57be724 100644 --- a/scripts/writerMenu.spec.ts +++ b/tests/unit/editor/writerMenu.spec.ts @@ -5,7 +5,7 @@ import { cutSelection, pasteClipboard, writerContextItems, -} from "../src/lib/editor/writerMenu.ts"; +} from "../../../src/lib/editor/writerMenu.ts"; type Harness = { selected: string; diff --git a/scripts/i18n.spec.ts b/tests/unit/i18n.spec.ts similarity index 96% rename from scripts/i18n.spec.ts rename to tests/unit/i18n.spec.ts index 8b868ef..5253be6 100644 --- a/scripts/i18n.spec.ts +++ b/tests/unit/i18n.spec.ts @@ -1,8 +1,8 @@ import assert from 'node:assert/strict'; import { test } from 'node:test'; -import { catalogs, messageRows } from '../src/lib/i18n/messages.ts'; +import { catalogs, messageRows } from '../../src/lib/i18n/messages.ts'; import { get } from 'svelte/store'; -import { LANGUAGE_KEY, locale, normalizeLocale, setLocale, t, translate, syncLocale } from '../src/lib/i18n/index.ts'; +import { LANGUAGE_KEY, locale, normalizeLocale, setLocale, t, translate, syncLocale } from '../../src/lib/i18n/index.ts'; test('Every catalog entry has all translations and preserves its placeholders', () => { const seen = new Set(); for (const [english, ...translations] of messageRows) { @@ -27,7 +27,7 @@ test('Language saves before reactive changes and syncs across windows', () => { const events = new Map(); const priorStorage = globalThis.localStorage, priorWindow = globalThis.window, priorDocument = globalThis.document; try { - globalThis.localStorage = { getItem: (key: string) => stored.get(key) ?? null, setItem: (key: string, value: string) => stored.set(key, value) } as Storage; + globalThis.localStorage = { getItem: (key: string) => stored.get(key) ?? null, setItem: (key: string, value: string) => stored.set(key, value) } as unknown as Storage; globalThis.window = { addEventListener: (key: string, handler: Function) => events.set(key, handler), removeEventListener: (key: string) => events.delete(key) } as unknown as Window & typeof globalThis; globalThis.document = { documentElement: { lang: '' } } as unknown as Document; const stop = syncLocale(); diff --git a/scripts/documentPanes.spec.ts b/tests/unit/layout/documentPanes.spec.ts similarity index 93% rename from scripts/documentPanes.spec.ts rename to tests/unit/layout/documentPanes.spec.ts index 642f249..63e0b55 100644 --- a/scripts/documentPanes.spec.ts +++ b/tests/unit/layout/documentPanes.spec.ts @@ -1,8 +1,8 @@ import { test } from "node:test"; import assert from "node:assert/strict"; -import { initialDocumentPanes, syncDocumentPanes, splitDocumentPane, closeDocumentPane, selectPane, readDocumentPane } from "../src/lib/workspace/documentPanes.ts"; -import { paneBounds } from "../src/lib/workspace/splitLayout.ts"; -import { registerSelection, selectedEditorText } from "../src/lib/editor/selection.ts"; +import { initialDocumentPanes, syncDocumentPanes, splitDocumentPane, closeDocumentPane, selectPane, readDocumentPane } from "../../../src/lib/workspace/documentPanes.ts"; +import { paneBounds } from "../../../src/lib/workspace/splitLayout.ts"; +import { registerSelection, selectedEditorText } from "../../../src/lib/editor/selection.ts"; test("opening a link to the right keeps its source and focuses an existing pane for duplicate targets", () => { let state = syncDocumentPanes(initialDocumentPanes(), ["a", "b", "c"], "a"); diff --git a/scripts/settings.spec.ts b/tests/unit/layout/settings.spec.ts similarity index 96% rename from scripts/settings.spec.ts rename to tests/unit/layout/settings.spec.ts index 1ee9193..723bdc4 100644 --- a/scripts/settings.spec.ts +++ b/tests/unit/layout/settings.spec.ts @@ -1,6 +1,6 @@ import { test } from "node:test"; import assert from "node:assert/strict"; -import { DEFAULT_SETTINGS, SETTINGS_KEY, parseSettings, saveSettings } from "../src/lib/workspace/settings.ts"; +import { DEFAULT_SETTINGS, SETTINGS_KEY, parseSettings, saveSettings } from "../../../src/lib/workspace/settings.ts"; test("missing or damaged preferences keep safe defaults", () => { for (const raw of [null, "{broken", "null", "[]", "42", '"text"']) { diff --git a/scripts/splitLayout.spec.ts b/tests/unit/layout/splitLayout.spec.ts similarity index 94% rename from scripts/splitLayout.spec.ts rename to tests/unit/layout/splitLayout.spec.ts index 8e80d7f..8cf548f 100644 --- a/scripts/splitLayout.spec.ts +++ b/tests/unit/layout/splitLayout.spec.ts @@ -1,6 +1,6 @@ import test from "node:test"; import assert from "node:assert/strict"; -import { splitPane, removePane, paneBounds, containsPane } from "../src/lib/workspace/splitLayout.ts"; +import { splitPane, removePane, paneBounds, containsPane } from "../../../src/lib/workspace/splitLayout.ts"; test("nested splits preserve the source and divide the requested pane", () => { const right = splitPane("a", "a", "b", "right"); diff --git a/scripts/tabActions.spec.ts b/tests/unit/layout/tabActions.spec.ts similarity index 93% rename from scripts/tabActions.spec.ts rename to tests/unit/layout/tabActions.spec.ts index 706cd38..5d7d139 100644 --- a/scripts/tabActions.spec.ts +++ b/tests/unit/layout/tabActions.spec.ts @@ -1,7 +1,7 @@ import { test } from "node:test"; import assert from "node:assert/strict"; -import { tabsToClose } from "../src/lib/workspace/tabActions.ts"; -import { Documents } from "../src/lib/workspace/documents.ts"; +import { tabsToClose } from "../../../src/lib/workspace/tabActions.ts"; +import { Documents } from "../../../src/lib/workspace/documents.ts"; function setup() { return new Documents({ diff --git a/scripts/workbenchLayout.spec.ts b/tests/unit/layout/workbenchLayout.spec.ts similarity index 94% rename from scripts/workbenchLayout.spec.ts rename to tests/unit/layout/workbenchLayout.spec.ts index e624aa9..498692a 100644 --- a/scripts/workbenchLayout.spec.ts +++ b/tests/unit/layout/workbenchLayout.spec.ts @@ -1,6 +1,6 @@ import { test } from "node:test"; import assert from "node:assert/strict"; -import { DEFAULT_WORKBENCH_LAYOUT, WORKBENCH_LAYOUT_KEY, parseWorkbenchLayout, saveWorkbenchLayout } from "../src/lib/workspace/workbenchLayout.ts"; +import { DEFAULT_WORKBENCH_LAYOUT, WORKBENCH_LAYOUT_KEY, parseWorkbenchLayout, saveWorkbenchLayout } from "../../../src/lib/workspace/workbenchLayout.ts"; test("missing and damaged layouts use defaults", () => { for (const raw of [null, "{broken", "null", "[]", "42", '"text"']) { diff --git a/scripts/workbenchTabs.spec.ts b/tests/unit/layout/workbenchTabs.spec.ts similarity index 89% rename from scripts/workbenchTabs.spec.ts rename to tests/unit/layout/workbenchTabs.spec.ts index cd5d0d8..ed7338c 100644 --- a/scripts/workbenchTabs.spec.ts +++ b/tests/unit/layout/workbenchTabs.spec.ts @@ -1,8 +1,8 @@ import { test } from "node:test"; import assert from "node:assert/strict"; -import { orderWorkbenchTabs } from "../src/lib/workspace/workbenchTabs.ts"; -import { tabsToClose } from "../src/lib/workspace/tabActions.ts"; -import { Documents } from "../src/lib/workspace/documents.ts"; +import { orderWorkbenchTabs } from "../../../src/lib/workspace/workbenchTabs.ts"; +import { tabsToClose } from "../../../src/lib/workspace/tabActions.ts"; +import { Documents } from "../../../src/lib/workspace/documents.ts"; test("mixed tabs retain their positions through title changes, closes, and new tabs", () => { const tabs = [ diff --git a/scripts/editorLinks.spec.ts b/tests/unit/links/editorLinks.spec.ts similarity index 95% rename from scripts/editorLinks.spec.ts rename to tests/unit/links/editorLinks.spec.ts index 08364a4..c6cf35b 100644 --- a/scripts/editorLinks.spec.ts +++ b/tests/unit/links/editorLinks.spec.ts @@ -1,6 +1,6 @@ import { test } from "node:test"; import assert from "node:assert/strict"; -import { documentLinks, documentLinkAt } from "../src/lib/editor/documentLinks.ts"; +import { documentLinks, documentLinkAt } from "../../../src/lib/editor/documentLinks.ts"; test("document links keep complete source ranges and decode Markdown destinations", () => { const source = '[Local]( "Title") and [Web](https://example.com/a_(b)) and [[Another note|Alias]]'; diff --git a/scripts/headingLinks.spec.ts b/tests/unit/links/headingLinks.spec.ts similarity index 96% rename from scripts/headingLinks.spec.ts rename to tests/unit/links/headingLinks.spec.ts index 7d4c889..35aff65 100644 --- a/scripts/headingLinks.spec.ts +++ b/tests/unit/links/headingLinks.spec.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import test from "node:test"; -import { documentHeadings, headingLinkLine, linkFragment } from "../src/lib/workspace/headingLinks.ts"; +import { documentHeadings, headingLinkLine, linkFragment } from "../../../src/lib/workspace/headingLinks.ts"; test("section links decode fragments without changing the file path", () => { assert.equal(linkFragment("notes/a%23b.md#Caf%C3%A9%20setup"), "Café setup"); diff --git a/scripts/linkCommands.spec.ts b/tests/unit/links/linkCommands.spec.ts similarity index 89% rename from scripts/linkCommands.spec.ts rename to tests/unit/links/linkCommands.spec.ts index d958236..6aaed6a 100644 --- a/scripts/linkCommands.spec.ts +++ b/tests/unit/links/linkCommands.spec.ts @@ -1,7 +1,7 @@ import assert from "node:assert/strict"; import test from "node:test"; -import { externalLinkText, workspaceLinkText } from "../src/lib/editor/linkCommands.ts"; -import { linkCandidates } from "../src/lib/workspace/markdownLinks.ts"; +import { externalLinkText, workspaceLinkText } from "../../../src/lib/editor/linkCommands.ts"; +import { linkCandidates } from "../../../src/lib/workspace/markdownLinks.ts"; test("external links prepare editable syntax with the cursor in the missing field", () => { const empty = externalLinkText("", { from: 0, to: 0 }); diff --git a/scripts/markdownLinks.spec.ts b/tests/unit/links/markdownLinks.spec.ts similarity index 87% rename from scripts/markdownLinks.spec.ts rename to tests/unit/links/markdownLinks.spec.ts index 3059ed4..3e82b68 100644 --- a/scripts/markdownLinks.spec.ts +++ b/tests/unit/links/markdownLinks.spec.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import test from "node:test"; -import { findMarkdownLinks, wikiCandidates } from "../src/lib/workspace/markdownLinks.ts"; +import { findMarkdownLinks, wikiCandidates } from "../../../src/lib/workspace/markdownLinks.ts"; test("markdown links skip image embeds", () => { const links = findMarkdownLinks("See [alpha](notes/a.md) and ![shot](pic.png)"); @@ -27,7 +27,7 @@ test("wikiCandidates add .md for a bare name", () => { }); -import { linkCandidates } from "../src/lib/workspace/markdownLinks.ts"; +import { linkCandidates } from "../../../src/lib/workspace/markdownLinks.ts"; test("links resolve relative to notes, including parent paths and encoded spaces", () => { assert.deepEqual(linkCandidates("notes/project/inbox.md", "../other%20note.md", "md"), ["notes/other note.md"]); diff --git a/scripts/tableLinkSource.spec.ts b/tests/unit/links/tableLinkSource.spec.ts similarity index 88% rename from scripts/tableLinkSource.spec.ts rename to tests/unit/links/tableLinkSource.spec.ts index f87d227..90b9c34 100644 --- a/scripts/tableLinkSource.spec.ts +++ b/tests/unit/links/tableLinkSource.spec.ts @@ -1,7 +1,7 @@ import { test } from "node:test"; import assert from "node:assert/strict"; -import { documentLinks } from "../src/lib/editor/documentLinks.ts"; -import { tableLinkLabelPosition } from "../src/lib/editor/tableLinkSource.ts"; +import { documentLinks } from "../../../src/lib/editor/documentLinks.ts"; +import { tableLinkLabelPosition } from "../../../src/lib/editor/tableLinkSource.ts"; test("table link reveal retains the clicked character through Markdown label marks", () => { for (const [source, offset, prefix] of [ diff --git a/scripts/workspaceFileLink.spec.ts b/tests/unit/links/workspaceFileLink.spec.ts similarity index 84% rename from scripts/workspaceFileLink.spec.ts rename to tests/unit/links/workspaceFileLink.spec.ts index 62fd40f..850898d 100644 --- a/scripts/workspaceFileLink.spec.ts +++ b/tests/unit/links/workspaceFileLink.spec.ts @@ -1,7 +1,7 @@ import test from "node:test"; import assert from "node:assert/strict"; -import { workspaceFileLink } from "../src/lib/editor/workspaceFileLink.ts"; -import { wordAt } from "../src/lib/editor/spellingWord.ts"; +import { workspaceFileLink } from "../../../src/lib/editor/workspaceFileLink.ts"; +import { wordAt } from "../../../src/lib/editor/spellingWord.ts"; test("file links resolve across nested folders and escape Markdown punctuation", () => { assert.equal(workspaceFileLink("notes/deep/source.md", "docs/a [draft](1).pdf"), "[a \\[draft\\](1).pdf](../../docs/a%20%5Bdraft%5D%281%29.pdf)"); diff --git a/scripts/completion.spec.ts b/tests/unit/plugins/completion.spec.ts similarity index 94% rename from scripts/completion.spec.ts rename to tests/unit/plugins/completion.spec.ts index 762c400..cb721a3 100644 --- a/scripts/completion.spec.ts +++ b/tests/unit/plugins/completion.spec.ts @@ -1,7 +1,7 @@ import test from 'node:test'; import assert from 'node:assert/strict'; -import { CompletionHub, eligible } from '../src/lib/completion/hub.ts'; -import type { CompletionSnapshot } from '../src/lib/completion/contracts.ts'; +import { CompletionHub, eligible } from '../../../src/lib/completion/hub.ts'; +import type { CompletionSnapshot } from '../../../src/lib/completion/contracts.ts'; const snapshot = (): CompletionSnapshot => ({ documentId: 'doc', revision: 1, text: 'The ', caret: 4, selectionEnd: 4, focused: true, kind: 'prose' }); const tick = () => new Promise(resolve => setTimeout(resolve, 0)); test('sensitive fields, composition, selections, code blocks and link targets are excluded', () => { diff --git a/scripts/externalPlugins.spec.ts b/tests/unit/plugins/externalPlugins.spec.ts similarity index 98% rename from scripts/externalPlugins.spec.ts rename to tests/unit/plugins/externalPlugins.spec.ts index b8f4364..76d80c5 100644 --- a/scripts/externalPlugins.spec.ts +++ b/tests/unit/plugins/externalPlugins.spec.ts @@ -1,7 +1,7 @@ import test from "node:test"; import assert from "node:assert/strict"; -import { ExternalSession } from "../src/lib/plugins/externalSession.ts"; -import type { PluginApi } from "../src/lib/plugins/sdk.ts"; +import { ExternalSession } from "../../../src/lib/plugins/externalSession.ts"; +import type { PluginApi } from "../../../src/lib/plugins/sdk.ts"; function fixture() { let writes = 0; const session = new ExternalSession("org.test.demo", { diff --git a/scripts/pluginAccess.spec.ts b/tests/unit/plugins/pluginAccess.spec.ts similarity index 92% rename from scripts/pluginAccess.spec.ts rename to tests/unit/plugins/pluginAccess.spec.ts index f286d82..b85961e 100644 --- a/scripts/pluginAccess.spec.ts +++ b/tests/unit/plugins/pluginAccess.spec.ts @@ -1,9 +1,9 @@ import test from "node:test"; import assert from "node:assert/strict"; import { readFileSync } from "node:fs"; -import { pluginAccess } from "../src/lib/plugins/access.ts"; -import { ExternalSession } from "../src/lib/plugins/externalSession.ts"; -import type { PluginApi, PluginCommand, PluginView } from "../src/lib/plugins/sdk.ts"; +import { pluginAccess } from "../../../src/lib/plugins/access.ts"; +import { ExternalSession } from "../../../src/lib/plugins/externalSession.ts"; +import type { PluginApi, PluginCommand, PluginView } from "../../../src/lib/plugins/sdk.ts"; const view = (id: string, extra: Partial = {}): PluginView => ({ id, title: id, mount() {}, ...extra }); const command = (id: string, extra: Partial = {}): PluginCommand => ({ id, title: id, run() {}, ...extra }); @@ -61,7 +61,7 @@ test("invalid access metadata fails registration", async () => { }); test("settings windows permit model checks and cancellation", () => { - const capability = JSON.parse(readFileSync(new URL("../src-tauri/capabilities/settings.json", import.meta.url), "utf8")); + const capability = JSON.parse(readFileSync(new URL("../../../src-tauri/capabilities/settings.json", import.meta.url), "utf8")); for (const permission of ["allow-completion-request", "allow-completion-cancel", "allow-plugins-data"]) assert(capability.permissions.includes(permission)); }); diff --git a/scripts/pluginDocuments.spec.ts b/tests/unit/plugins/pluginDocuments.spec.ts similarity index 96% rename from scripts/pluginDocuments.spec.ts rename to tests/unit/plugins/pluginDocuments.spec.ts index 707cee0..75c6132 100644 --- a/scripts/pluginDocuments.spec.ts +++ b/tests/unit/plugins/pluginDocuments.spec.ts @@ -1,7 +1,7 @@ import test from "node:test"; import assert from "node:assert/strict"; -import { ExternalSession } from "../src/lib/plugins/externalSession.ts"; -import type { PluginApi, PluginDocumentType } from "../src/lib/plugins/sdk.ts"; +import { ExternalSession } from "../../../src/lib/plugins/externalSession.ts"; +import type { PluginApi, PluginDocumentType } from "../../../src/lib/plugins/sdk.ts"; const services = { workspace: { list: async () => [], read: async () => "", write: async () => {} }, diff --git a/scripts/pluginHostExtensions.spec.ts b/tests/unit/plugins/pluginHostExtensions.spec.ts similarity index 91% rename from scripts/pluginHostExtensions.spec.ts rename to tests/unit/plugins/pluginHostExtensions.spec.ts index c5e3dbd..7fcaae2 100644 --- a/scripts/pluginHostExtensions.spec.ts +++ b/tests/unit/plugins/pluginHostExtensions.spec.ts @@ -1,8 +1,8 @@ import test from "node:test"; import assert from "node:assert/strict"; -import { ExternalSession } from "../src/lib/plugins/externalSession.ts"; -import { ContributionRegistry } from "../src/lib/plugins/registry.ts"; -import type { PluginApi } from "../src/lib/plugins/sdk.ts"; +import { ExternalSession } from "../../../src/lib/plugins/externalSession.ts"; +import { ContributionRegistry } from "../../../src/lib/plugins/registry.ts"; +import type { PluginApi } from "../../../src/lib/plugins/sdk.ts"; test("Git and file access stop before plugin cleanup", async () => { const calls: unknown[] = []; @@ -18,6 +18,7 @@ test("Git and file access stop before plugin cleanup", async () => { stage: async paths => { calls.push(paths); }, unstage: async paths => { calls.push(paths); }, commit: async message => { calls.push(message); }, blame: async () => null, push: async () => { calls.push('push'); }, pull: async () => { calls.push('pull'); }, graph: async () => ({ commits: [] }), + commitDetails: async () => { throw new Error("not used"); }, commitDiff: async () => "", }, }, () => {}, () => {}, registry); await session.start({ activate(value) { api = value; api.contribute("git", { blame: (path, line) => api.git!.blame(path, line) }); } }); diff --git a/scripts/pluginPackaging.spec.ts b/tests/unit/plugins/pluginPackaging.spec.ts similarity index 97% rename from scripts/pluginPackaging.spec.ts rename to tests/unit/plugins/pluginPackaging.spec.ts index bcdbbe8..df08712 100644 --- a/scripts/pluginPackaging.spec.ts +++ b/tests/unit/plugins/pluginPackaging.spec.ts @@ -4,7 +4,7 @@ import { mkdtemp, mkdir, readFile, writeFile, rm, realpath } from "node:fs/promi import { tmpdir } from "node:os"; import { join } from "node:path"; // @ts-ignore The build tool is a JavaScript module. -import { packagePlugin } from "./packagePlugin.mjs"; +import { packagePlugin } from "../../../scripts/packagePlugin.mjs"; test("plugin packaging rejects invalid release inputs before writing an archive", async () => { const root = await mkdtemp(join(tmpdir(), "runestone-packaging-")); diff --git a/scripts/plugins.spec.ts b/tests/unit/plugins/plugins.spec.ts similarity index 90% rename from scripts/plugins.spec.ts rename to tests/unit/plugins/plugins.spec.ts index 745e7a9..e9efbbb 100644 --- a/scripts/plugins.spec.ts +++ b/tests/unit/plugins/plugins.spec.ts @@ -1,15 +1,15 @@ import test from "node:test"; import assert from "node:assert/strict"; -import { ContributionRegistry, pluginHost } from "../src/lib/plugins/registry.ts"; -import { ExternalSession } from "../src/lib/plugins/externalSession.ts"; +import { ContributionRegistry, pluginHost } from "../../../src/lib/plugins/registry.ts"; +import { ExternalSession } from "../../../src/lib/plugins/externalSession.ts"; import { existsSync } from "node:fs"; // The Table Formulas package comes from a sibling repository. Run `pnpm build:plugins` to build it. -const tableFormulasEntry = new URL("../plugin-packages/table-formulas/main.js", import.meta.url); +const tableFormulasEntry = new URL("../../../plugin-packages/table-formulas/main.js", import.meta.url); const tableFormulas = existsSync(tableFormulasEntry) ? await import(tableFormulasEntry.href) : undefined; const activate = tableFormulas?.activate; const needsTableFormulas = { skip: tableFormulas ? false : "the Table Formulas package is not built; run pnpm build:plugins" }; -import { renderMarkdownHtml, renderMarkdownSections } from "../src/lib/workspace/noteHtml.ts"; -import type { PluginApi } from "../src/lib/plugins/sdk.ts"; +import { renderMarkdownHtml, renderMarkdownSections } from "../../../src/lib/workspace/noteHtml.ts"; +import type { PluginApi } from "../../../src/lib/plugins/sdk.ts"; const services = { workspace: { list: async () => [], read: async () => "", write: async () => {} }, diff --git a/scripts/installerVersion.spec.ts b/tests/unit/release/installerVersion.spec.ts similarity index 98% rename from scripts/installerVersion.spec.ts rename to tests/unit/release/installerVersion.spec.ts index 5c4b638..b090747 100644 --- a/scripts/installerVersion.spec.ts +++ b/tests/unit/release/installerVersion.spec.ts @@ -5,7 +5,7 @@ import { tmpdir } from 'node:os'; import path from 'node:path'; import { spawnSync } from 'node:child_process'; import { existsSync } from 'node:fs'; -import { releaseVersion, nextHotfix, compareReleases } from './releaseVersion.mjs'; +import { releaseVersion, nextHotfix, compareReleases } from '../../../scripts/releaseVersion.mjs'; const ordering = ['0.1.22z', '0.1.23', '0.1.23a', '0.1.23b', '0.1.23c', '0.1.23z', '0.1.23aa', '0.1.23ab', '0.1.23zz', '0.1.23aaa', '0.1.24']; diff --git a/scripts/tableFormulas.spec.ts b/tests/unit/tables/formulas.spec.ts similarity index 87% rename from scripts/tableFormulas.spec.ts rename to tests/unit/tables/formulas.spec.ts index c70c036..8efcf7a 100644 --- a/scripts/tableFormulas.spec.ts +++ b/tests/unit/tables/formulas.spec.ts @@ -1,9 +1,9 @@ import assert from "node:assert/strict"; import test, { before, after } from "node:test"; -import { ExternalSession } from "../src/lib/plugins/externalSession.ts"; +import { ExternalSession } from "../../../src/lib/plugins/externalSession.ts"; import { existsSync } from "node:fs"; // The Table Formulas package comes from a sibling repository. Run `pnpm build:plugins` to build it. -const tableFormulasEntry = new URL("../plugin-packages/table-formulas/main.js", import.meta.url); +const tableFormulasEntry = new URL("../../../plugin-packages/table-formulas/main.js", import.meta.url); const tableFormulas = existsSync(tableFormulasEntry) ? await import(tableFormulasEntry.href) : undefined; const activate = tableFormulas?.activate; const needsTableFormulas = { skip: tableFormulas ? false : "the Table Formulas package is not built; run pnpm build:plugins" }; @@ -15,8 +15,8 @@ const session = new ExternalSession("runestone.table-formulas", { before(() => activate && session.start({ activate })); after(() => activate && session.stop()); -import { tableCellMarkdown } from "../src/lib/editor/tableCellMarkdown.ts"; -import { renderMarkdownHtml, renderMarkdownSections } from "../src/lib/workspace/noteHtml.ts"; +import { tableCellMarkdown } from "../../../src/lib/editor/tableCellMarkdown.ts"; +import { renderMarkdownHtml, renderMarkdownSections } from "../../../src/lib/workspace/noteHtml.ts"; test("Markdown rendering isolates tables and preserves literal, formatted, and non-table text", needsTableFormulas, () => { const source = "| X | Y | Result |\r\n| --- | --- | --- |\r\n| 9 | 10 | =AVERAGE(A2:B2) |\r\n\r\n| X | Y | Result |\r\n| --- | --- | --- |\r\n| 1 | 3 | =A2*B2 |\r\n"; diff --git a/scripts/markdownTable.spec.ts b/tests/unit/tables/markdownTable.spec.ts similarity index 96% rename from scripts/markdownTable.spec.ts rename to tests/unit/tables/markdownTable.spec.ts index 99bce9a..b9647b9 100644 --- a/scripts/markdownTable.spec.ts +++ b/tests/unit/tables/markdownTable.spec.ts @@ -1,8 +1,8 @@ import assert from "node:assert/strict"; import test from "node:test"; -import { appendTableColumn, appendTableRow, parseMarkdownTable, replaceTableCell } from "../src/lib/editor/markdownTable.ts"; -import { tableCellMarkdown, extractedCellMarkdown } from "../src/lib/editor/tableCellMarkdown.ts"; -import { renderMarkdownHtml, renderMarkdownSections } from "../src/lib/workspace/noteHtml.ts"; +import { appendTableColumn, appendTableRow, parseMarkdownTable, replaceTableCell } from "../../../src/lib/editor/markdownTable.ts"; +import { tableCellMarkdown, extractedCellMarkdown } from "../../../src/lib/editor/tableCellMarkdown.ts"; +import { renderMarkdownHtml, renderMarkdownSections } from "../../../src/lib/workspace/noteHtml.ts"; const table = "| Ticker | Notes |\n| :--- | ---: |\n| IBKR.US | First
Second |"; diff --git a/scripts/tableSelection.spec.ts b/tests/unit/tables/selection.spec.ts similarity index 93% rename from scripts/tableSelection.spec.ts rename to tests/unit/tables/selection.spec.ts index 64c4af2..c557d88 100644 --- a/scripts/tableSelection.spec.ts +++ b/tests/unit/tables/selection.spec.ts @@ -1,10 +1,10 @@ import assert from "node:assert/strict"; import test from "node:test"; -import { alignTableCells, clipboardCells, copyTableCells, copyTableMarkdown, deleteTableCells, formatTableCells, mapTableCells, pasteTableCells } from "../src/lib/editor/tableSelection.ts"; -import { htmlToMarkdown } from "../src/lib/workspace/htmlToMarkdown.ts"; -import { parseMarkdownTable } from "../src/lib/editor/markdownTable.ts"; -import { renderMarkdownHtml, plainInlineMarkdown } from "../src/lib/workspace/noteHtml.ts"; -import { tableCellMarkdown } from "../src/lib/editor/tableCellMarkdown.ts"; +import { alignTableCells, clipboardCells, copyTableCells, copyTableMarkdown, deleteTableCells, formatTableCells, mapTableCells, pasteTableCells } from "../../../src/lib/editor/tableSelection.ts"; +import { htmlToMarkdown } from "../../../src/lib/workspace/htmlToMarkdown.ts"; +import { parseMarkdownTable } from "../../../src/lib/editor/markdownTable.ts"; +import { renderMarkdownHtml, plainInlineMarkdown } from "../../../src/lib/workspace/noteHtml.ts"; +import { tableCellMarkdown } from "../../../src/lib/editor/tableCellMarkdown.ts"; const source = "| A | B | C |\r\n| --- | :---: | ---: |\r\n| one | two | three |\r\n| four | five | six |\r\n\r\nTail"; const range = { anchor: { row: 2, column: 1 }, head: { row: 1, column: 0 } }; diff --git a/scripts/tableStructure.spec.ts b/tests/unit/tables/structure.spec.ts similarity index 97% rename from scripts/tableStructure.spec.ts rename to tests/unit/tables/structure.spec.ts index 31d14a0..1a2bcd3 100644 --- a/scripts/tableStructure.spec.ts +++ b/tests/unit/tables/structure.spec.ts @@ -1,7 +1,7 @@ import assert from "node:assert/strict"; import test from "node:test"; -import { changeTableStructure, moveTableAxis, sortTableColumn } from "../src/lib/editor/tableStructure.ts"; -import { parseMarkdownTable } from "../src/lib/editor/markdownTable.ts"; +import { changeTableStructure, moveTableAxis, sortTableColumn } from "../../../src/lib/editor/tableStructure.ts"; +import { parseMarkdownTable } from "../../../src/lib/editor/markdownTable.ts"; const source = "| Name | Value |\r\n| :--- | ---: |\r\n| Zebra | `2` |\r\n| **Apple** | 10 |\r\n| apple | 3 |\r\n| | 1 |\r\n\r\nTail"; const values = (text: string) => parseMarkdownTable(text)!.rows.map(row => row.cells.map(cell => cell.text)); diff --git a/scripts/appearance.spec.ts b/tests/unit/theme/appearance.spec.ts similarity index 96% rename from scripts/appearance.spec.ts rename to tests/unit/theme/appearance.spec.ts index 4f72c97..85f4e16 100644 --- a/scripts/appearance.spec.ts +++ b/tests/unit/theme/appearance.spec.ts @@ -1,8 +1,8 @@ import assert from 'node:assert/strict'; import { test } from 'node:test'; -import { parseCustomTheme } from '../src/lib/theme/customThemes.ts'; -import { CHARACTER_THEMES, SYNTAX_ROLES } from '../src/lib/theme/characterThemes.ts'; -import { parseAppearance, normalizeAppearance, exportAppearanceTheme, BUILTIN_THEMES, THEMES, themeModes } from '../src/lib/theme/appearance.ts'; +import { parseCustomTheme } from '../../../src/lib/theme/customThemes.ts'; +import { CHARACTER_THEMES, SYNTAX_ROLES } from '../../../src/lib/theme/characterThemes.ts'; +import { parseAppearance, normalizeAppearance, exportAppearanceTheme, BUILTIN_THEMES, THEMES, themeModes } from '../../../src/lib/theme/appearance.ts'; test('Removed palettes preserve the saved mode with the default palette', () => { for (const theme of ['gpt', 'terminal', 'unknown', 'renamon', 'asuka-school']) { diff --git a/scripts/asukaPalette.spec.ts b/tests/unit/theme/asukaPalette.spec.ts similarity index 96% rename from scripts/asukaPalette.spec.ts rename to tests/unit/theme/asukaPalette.spec.ts index 9c6a3d4..5bd4a6e 100644 --- a/scripts/asukaPalette.spec.ts +++ b/tests/unit/theme/asukaPalette.spec.ts @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { test } from 'node:test'; -import { characterTheme, SYNTAX_ROLES } from '../src/lib/theme/characterThemes.ts'; +import { characterTheme, SYNTAX_ROLES } from '../../../src/lib/theme/characterThemes.ts'; const rgb = (color: string) => color.slice(1).match(/../g)!.map(value => parseInt(value, 16)); const mix = (foreground: string, background: string, opacity: number) => '#' + rgb(foreground) diff --git a/scripts/backgrounds.spec.ts b/tests/unit/theme/backgrounds.spec.ts similarity index 94% rename from scripts/backgrounds.spec.ts rename to tests/unit/theme/backgrounds.spec.ts index 0bf9d91..f58a992 100644 --- a/scripts/backgrounds.spec.ts +++ b/tests/unit/theme/backgrounds.spec.ts @@ -1,9 +1,9 @@ import test from 'node:test'; import { readFileSync } from 'node:fs'; import assert from 'node:assert/strict'; -import { BackgroundHub, backgroundHub } from '../src/lib/plugins/backgrounds.ts'; -import { ExternalSession } from '../src/lib/plugins/externalSession.ts'; -import type { BackgroundFrame, PluginApi } from '../src/lib/plugins/sdk.ts'; +import { BackgroundHub, backgroundHub } from '../../../src/lib/plugins/backgrounds.ts'; +import { ExternalSession } from '../../../src/lib/plugins/externalSession.ts'; +import type { BackgroundFrame, PluginApi } from '../../../src/lib/plugins/sdk.ts'; const frame: BackgroundFrame = { url: 'blob:http://localhost/example', overlay: 0.3, position: 'center', size: 'cover' }; @@ -144,9 +144,9 @@ test('disable removes frames and subscriptions before cleanup and rejects pendin test('background commands are allowed in main and settings windows', () => { - const build = readFileSync(new URL('../src-tauri/build.rs', import.meta.url), 'utf8'); + const build = readFileSync(new URL('../../../src-tauri/build.rs', import.meta.url), 'utf8'); for (const scope of ['default', 'settings']) { - const capability = JSON.parse(readFileSync(new URL(`../src-tauri/capabilities/${scope}.json`, import.meta.url), 'utf8')); + const capability = JSON.parse(readFileSync(new URL(`../../../src-tauri/capabilities/${scope}.json`, import.meta.url), 'utf8')); for (const command of ['backgrounds_choose_folder', 'backgrounds_default_folder', 'backgrounds_list', 'backgrounds_read', 'backgrounds_read_image_settings', 'backgrounds_write_image_settings']) { assert(build.includes(`"${command}"`), `${command} needs a generated desktop permission`); assert(capability.permissions.includes(`allow-${command.replaceAll('_', '-')}`), `${scope} must allow ${command}`); diff --git a/scripts/customThemes.spec.ts b/tests/unit/theme/customThemes.spec.ts similarity index 94% rename from scripts/customThemes.spec.ts rename to tests/unit/theme/customThemes.spec.ts index 5b3c309..6ed32bd 100644 --- a/scripts/customThemes.spec.ts +++ b/tests/unit/theme/customThemes.spec.ts @@ -1,7 +1,7 @@ import { test } from 'node:test'; import assert from 'node:assert/strict'; -import { COLOR_TOKENS, parseCustomTheme } from '../src/lib/theme/customThemes.ts'; -import { applyTransparency, normalizeAppearance, exportAppearanceTheme, BUILTIN_THEMES, themeModes } from '../src/lib/theme/appearance.ts'; +import { COLOR_TOKENS, parseCustomTheme } from '../../../src/lib/theme/customThemes.ts'; +import { applyTransparency, normalizeAppearance, exportAppearanceTheme, BUILTIN_THEMES, themeModes } from '../../../src/lib/theme/appearance.ts'; const palette = { bg: '#123', text: '#abcdef', accent: '#AABBCC' }; const theme = { schema: 2, id: 'my-theme', name: 'My theme', colors: palette }; test('Fixed theme palettes retain all supplied colors', () => { @@ -80,12 +80,12 @@ test('Opaque mode retains background ownership and the amount for re-enabling', }); test('Saved legacy light themes migrate once and preserve both original palettes', async () => { - const { customThemes, CUSTOM_THEMES_KEY } = await import('../src/lib/theme/customThemes.ts'); + const { customThemes, CUSTOM_THEMES_KEY } = await import('../../../src/lib/theme/customThemes.ts'); const legacy = { schema: 1, id: 'saved-light', name: 'Saved light', light: { ...palette, bg: '#fff' }, dark: { ...palette, bg: '#111' } }; const stored = new Map([[CUSTOM_THEMES_KEY, JSON.stringify([legacy])], ['runestone.appearance', JSON.stringify({ theme: 'custom:saved-light', mode: 'light' })]]); const previous = globalThis.localStorage; try { - globalThis.localStorage = { getItem: (key: string) => stored.get(key) ?? null, setItem: (key: string, value: string) => stored.set(key, value) } as Storage; + globalThis.localStorage = { getItem: (key: string) => stored.get(key) ?? null, setItem: (key: string, value: string) => stored.set(key, value) } as unknown as Storage; assert.deepEqual(customThemes()[0].colors, legacy.light); assert.deepEqual(themeModes('custom:saved-light'), ['light']); assert.equal(normalizeAppearance({ theme: 'custom:saved-light', mode: 'dark' }).mode, 'light'); @@ -97,7 +97,7 @@ test('Saved legacy light themes migrate once and preserve both original palettes }); test('Legacy migration storage failure leaves the original palette available', async () => { - const { customThemes, CUSTOM_THEMES_KEY } = await import('../src/lib/theme/customThemes.ts'); + const { customThemes, CUSTOM_THEMES_KEY } = await import('../../../src/lib/theme/customThemes.ts'); const legacy = { schema: 1, id: 'quota-light', name: 'Quota light', light: { ...palette, bg: '#fefefe' }, dark: palette }; const raw = JSON.stringify([legacy]); const previous = globalThis.localStorage; diff --git a/scripts/malfoidPalette.spec.ts b/tests/unit/theme/malfoidPalette.spec.ts similarity index 95% rename from scripts/malfoidPalette.spec.ts rename to tests/unit/theme/malfoidPalette.spec.ts index 0bb95d8..a364d68 100644 --- a/scripts/malfoidPalette.spec.ts +++ b/tests/unit/theme/malfoidPalette.spec.ts @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import test from 'node:test'; -import { CHARACTER_THEMES, SYNTAX_ROLES } from '../src/lib/theme/characterThemes.ts'; +import { CHARACTER_THEMES, SYNTAX_ROLES } from '../../../src/lib/theme/characterThemes.ts'; const rgb = (hex: string) => hex.match(/[0-9a-f]{2}/gi)!.map(channel => parseInt(channel, 16)); const luminance = (hex: string) => rgb(hex).map(channel => channel / 255) diff --git a/scripts/themePalette.spec.ts b/tests/unit/theme/themePalette.spec.ts similarity index 97% rename from scripts/themePalette.spec.ts rename to tests/unit/theme/themePalette.spec.ts index 71e37e1..b4942b9 100644 --- a/scripts/themePalette.spec.ts +++ b/tests/unit/theme/themePalette.spec.ts @@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { test } from 'node:test'; -import { characterTheme, characterSyntax, SYNTAX_ROLES } from '../src/lib/theme/characterThemes.ts'; +import { characterTheme, characterSyntax, SYNTAX_ROLES } from '../../../src/lib/theme/characterThemes.ts'; const rgb = (color: string) => color.slice(1).match(/../g)!.map(value => parseInt(value, 16) / 255); function luminance(color: string) { diff --git a/scripts/treeActions.spec.ts b/tests/unit/tree/actions.spec.ts similarity index 93% rename from scripts/treeActions.spec.ts rename to tests/unit/tree/actions.spec.ts index 0d08491..a1de7b3 100644 --- a/scripts/treeActions.spec.ts +++ b/tests/unit/tree/actions.spec.ts @@ -1,8 +1,8 @@ import assert from "node:assert/strict"; import test from "node:test"; -import { actionEntries, selectionRoots, setSelectedMarks, runTreeActions } from "../src/lib/workspace/treeActions.ts"; -import { planDrop } from "../src/lib/workspace/treeDrop.ts"; -import type { TreeEntry } from "../src/lib/workspace/types.ts"; +import { actionEntries, selectionRoots, setSelectedMarks, runTreeActions } from "../../../src/lib/workspace/treeActions.ts"; +import { planDrop } from "../../../src/lib/workspace/treeDrop.ts"; +import type { TreeEntry } from "../../../src/lib/workspace/types.ts"; const entry = (rel_path: string, kind: "file" | "folder" = "file"): TreeEntry => ({ rel_path, name: rel_path.split("/").pop()!, kind }); const entries = [entry("notes", "folder"), entry("notes/a.md"), entry("notes/sub", "folder"), entry("notes/sub/b.md"), entry("notes-old/c.md"), entry("z.md")]; diff --git a/scripts/treeDrop.spec.ts b/tests/unit/tree/drop.spec.ts similarity index 98% rename from scripts/treeDrop.spec.ts rename to tests/unit/tree/drop.spec.ts index c0489c1..125b6bd 100644 --- a/scripts/treeDrop.spec.ts +++ b/tests/unit/tree/drop.spec.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import test from "node:test"; -import { dropHint, dropPlaceAt, planDrop, uniqueName } from "../src/lib/workspace/treeDrop.ts"; +import { dropHint, dropPlaceAt, planDrop, uniqueName } from "../../../src/lib/workspace/treeDrop.ts"; function kids(map: Record) { return (parent: string) => map[parent] ?? []; diff --git a/scripts/treeMoveHistory.spec.ts b/tests/unit/tree/moveHistory.spec.ts similarity index 93% rename from scripts/treeMoveHistory.spec.ts rename to tests/unit/tree/moveHistory.spec.ts index f74b8f7..0e46c44 100644 --- a/scripts/treeMoveHistory.spec.ts +++ b/tests/unit/tree/moveHistory.spec.ts @@ -1,6 +1,6 @@ import { test } from "node:test"; import assert from "node:assert/strict"; -import { moveMarks, replayMoveMarks } from "../src/lib/workspace/treeMoveHistory.ts"; +import { moveMarks, replayMoveMarks } from "../../../src/lib/workspace/treeMoveHistory.ts"; test("move undo preserves later bookmarks, pins, and new files", () => { const before = { pins: ["notes/a.md"], bookmarks: [], order: { notes: ["a.md", "b.md"], archive: [] as string[] } }; const after = moveMarks(before, "notes/a.md", "archive/a.md"); diff --git a/scripts/treeSelection.spec.ts b/tests/unit/tree/selection.spec.ts similarity index 97% rename from scripts/treeSelection.spec.ts rename to tests/unit/tree/selection.spec.ts index 88456cf..f8079dc 100644 --- a/scripts/treeSelection.spec.ts +++ b/tests/unit/tree/selection.spec.ts @@ -1,7 +1,7 @@ import assert from "node:assert/strict"; import test from "node:test"; -import { selectTreePath, treeSelectionEdges, visibleTreePaths, type TreeSelection } from "../src/lib/workspace/treeSelection.ts"; -import type { TreeEntry } from "../src/lib/workspace/types.ts"; +import { selectTreePath, treeSelectionEdges, visibleTreePaths, type TreeSelection } from "../../../src/lib/workspace/treeSelection.ts"; +import type { TreeEntry } from "../../../src/lib/workspace/types.ts"; const entry = (rel_path: string, kind: "file" | "folder" = "file"): TreeEntry => ({ rel_path, name: rel_path.split("/").pop()!, kind }); const children = { diff --git a/scripts/chrome.spec.ts b/tests/unit/workspace/chrome.spec.ts similarity index 89% rename from scripts/chrome.spec.ts rename to tests/unit/workspace/chrome.spec.ts index 735f750..2a44a06 100644 --- a/scripts/chrome.spec.ts +++ b/tests/unit/workspace/chrome.spec.ts @@ -1,7 +1,7 @@ import assert from "node:assert/strict"; import test from "node:test"; -import { detectChrome, extensionOf, treeFileParts } from "../src/lib/workspace/chrome.ts"; -import { monacoChrome } from "../src/lib/editor/monacoChrome.ts"; +import { detectChrome, extensionOf, treeFileParts } from "../../../src/lib/workspace/chrome.ts"; +import { monacoChrome } from "../../../src/lib/editor/monacoChrome.ts"; test("markdown files open in writing chrome", () => { assert.equal(detectChrome("notes/inbox.md"), "Writing"); diff --git a/scripts/documentSession.spec.ts b/tests/unit/workspace/documentSession.spec.ts similarity index 96% rename from scripts/documentSession.spec.ts rename to tests/unit/workspace/documentSession.spec.ts index 42af354..3efe10d 100644 --- a/scripts/documentSession.spec.ts +++ b/tests/unit/workspace/documentSession.spec.ts @@ -1,6 +1,6 @@ import { test } from "node:test"; import assert from "node:assert/strict"; -import { documentSessionKey, parseDocumentSession, restoreDocumentSession } from "../src/lib/workspace/documentSession.ts"; +import { documentSessionKey, parseDocumentSession, restoreDocumentSession } from "../../../src/lib/workspace/documentSession.ts"; test("document sessions isolate workspaces and discard unsafe or duplicate paths", () => { assert.notEqual(documentSessionKey("C:\\one"), documentSessionKey("C:\\two")); diff --git a/scripts/documents.spec.ts b/tests/unit/workspace/documents.spec.ts similarity index 99% rename from scripts/documents.spec.ts rename to tests/unit/workspace/documents.spec.ts index b3ba4b1..4c9a9e2 100644 --- a/scripts/documents.spec.ts +++ b/tests/unit/workspace/documents.spec.ts @@ -1,6 +1,6 @@ import { test } from "node:test"; import assert from "node:assert/strict"; -import { Documents } from "../src/lib/workspace/documents.ts"; +import { Documents } from "../../../src/lib/workspace/documents.ts"; function deferred() { let resolve!: (value: T) => void; diff --git a/scripts/noteIndex.spec.ts b/tests/unit/workspace/noteIndex.spec.ts similarity index 98% rename from scripts/noteIndex.spec.ts rename to tests/unit/workspace/noteIndex.spec.ts index 92fef1b..3da143c 100644 --- a/scripts/noteIndex.spec.ts +++ b/tests/unit/workspace/noteIndex.spec.ts @@ -1,6 +1,6 @@ import test from "node:test"; import assert from "node:assert/strict"; -import { WorkspaceNoteIndex, type NoteIndexIO } from "../src/lib/workspace/noteIndex.ts"; +import { WorkspaceNoteIndex, type NoteIndexIO } from "../../../src/lib/workspace/noteIndex.ts"; function workspace(files: Map): NoteIndexIO { return { diff --git a/scripts/renamePath.spec.ts b/tests/unit/workspace/renamePath.spec.ts similarity index 97% rename from scripts/renamePath.spec.ts rename to tests/unit/workspace/renamePath.spec.ts index 078818e..bdf3cf3 100644 --- a/scripts/renamePath.spec.ts +++ b/tests/unit/workspace/renamePath.spec.ts @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import test from "node:test"; -import { planRename, planTitleRename, planMarkdownTitleRename, planDocumentTitleRename } from "../src/lib/workspace/renamePath.ts"; +import { planRename, planTitleRename, planMarkdownTitleRename, planDocumentTitleRename } from "../../../src/lib/workspace/renamePath.ts"; test("rename in a folder keeps the parent", () => { assert.deepEqual(planRename("notes/a.md", "b.md"), { diff --git a/tsconfig.json b/tsconfig.json index 963ded0..f3714fe 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,19 @@ "sourceMap": true, "strict": true, "moduleResolution": "bundler" - } + }, + // The app check leaves out tests/. They run in Node and have their own tests/tsconfig.json. + // These entries copy the SvelteKit excludes, which TypeScript does not merge. + "exclude": [ + "node_modules/**", + "src/service-worker.js", + "src/service-worker/**/*.js", + "src/service-worker.ts", + "src/service-worker/**/*.ts", + "src/service-worker.d.ts", + "src/service-worker/**/*.d.ts", + "tests/**" + ] // Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias // except $lib which is handled by https://svelte.dev/docs/kit/configuration#files // diff --git a/vite.config.js b/vite.config.js index 30e7c51..810b0b2 100644 --- a/vite.config.js +++ b/vite.config.js @@ -1,6 +1,5 @@ import { defineConfig } from "vite"; import { sveltekit } from "@sveltejs/kit/vite"; -// @ts-expect-error type error without @types/node package import process from "node:process"; const host = process.env.TAURI_DEV_HOST;