Move the tests from scripts/ to tests/ by feature

Unit tests go to tests/unit/<area>/, browser smoke tests to
tests/smoke/<area>/, 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.
This commit is contained in:
Knotty Wyvern
2026-10-27 19:47:39 -07:00
parent 90d1940c73
commit e433bed28e
154 changed files with 269 additions and 227 deletions
+2 -2
View File
@@ -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.
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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).
+2 -2
View File
@@ -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
+5 -5
View File
@@ -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 |
+23 -23
View File
@@ -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": {
+9 -9
View File
@@ -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.
+3 -3
View File
@@ -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.
+1 -1
View File
@@ -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.