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 = '
| Ticker | Name |
|---|---|
| ADBE.US | Adobe |
| ADSK.US | Autodesk |