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
+1 -1
View File
@@ -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. - 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. - 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. - 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. 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. - Record a rule change, a recurring problem, or an exception in `docs/design-decisions.md`. An isolated fix needs no entry.
+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. Plugin installation still lists all installed plugins.
Live Markdown formatting refreshes when background parsing finishes after a large paste. 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 `tests/smoke/editor/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/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. 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/`. 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. 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. 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. 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. 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. 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. - 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. - 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. - 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. - 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. `scripts/hostAppearance.smoke.mjs` checks the exact controls and exports. - 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. - Limits: Browser checks use desktop mocks. Native display and user acceptance remain open.
### UI-029 — Text selection transparency ### 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 build` | The production frontend build |
| `pnpm check:menus` | The inventory of menu surfaces. See [Interface design](ui-design.md). | | `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`. For type errors while you edit, run `pnpm check:watch`.
Some tests need files from outside this repository: 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). - `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).
- `scripts/installerVersion.spec.ts` needs the NSIS compiler that the Tauri CLI downloads on Windows. - `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. - The Rust terminal tests start the real shells on the computer.
## Browser smoke tests ## 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. Set `PLAYWRIGHT_MODULE` to the folder of an installed `playwright` package.
If that package has no Chromium, set `CHROME_PATH` to an installed browser. 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. 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: Example for PowerShell. Replace the paths with your own:
```powershell ```powershell
$env:PLAYWRIGHT_MODULE = "C:\tools\browser-tests\node_modules\playwright" $env:PLAYWRIGHT_MODULE = "C:\tools\browser-tests\node_modules\playwright"
$env:CHROME_PATH = "C:\Program Files\Google\Chrome\Application\chrome.exe" $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 | | Variable | Use |
+23 -23
View File
@@ -22,7 +22,7 @@
"action": 2 "action": 2
}, },
"design": "Shared action menu", "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": { "RuneStone/src/lib/browser/Settings.svelte": {
"counts": { "counts": {
@@ -30,77 +30,77 @@
"localPopup": 2 "localPopup": 2
}, },
"design": "Shared action menu", "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": { "RuneStone/src/lib/browser/WebData.svelte": {
"counts": { "counts": {
"action": 1 "action": 1
}, },
"design": "Shared action menu", "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": { "RuneStone/src/lib/editor/codeMenu.ts": {
"counts": { "counts": {
"action": 1 "action": 1
}, },
"design": "Shared action menu", "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": { "RuneStone/src/lib/editor/imageControls.ts": {
"counts": { "counts": {
"action": 1 "action": 1
}, },
"design": "Shared action menu", "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": { "RuneStone/src/lib/editor/markdownMenu.ts": {
"counts": { "counts": {
"action": 2 "action": 2
}, },
"design": "Shared action menu", "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": { "RuneStone/src/lib/editor/readingMenu.ts": {
"counts": { "counts": {
"action": 1 "action": 1
}, },
"design": "Shared action menu", "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": { "RuneStone/src/lib/editor/spellingMenu.ts": {
"counts": { "counts": {
"action": 1 "action": 1
}, },
"design": "Shared action menu", "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": { "RuneStone/src/lib/editor/tableSelectionControls.ts": {
"counts": { "counts": {
"action": 1 "action": 1
}, },
"design": "Shared action menu", "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": { "RuneStone/src/lib/editor/WriterHost.svelte": {
"counts": { "counts": {
"svelteMenu": 1 "svelteMenu": 1
}, },
"design": "Shared action menu", "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": { "RuneStone/src/lib/layout/ContextMenu.svelte": {
"counts": { "counts": {
"action": 1 "action": 1
}, },
"design": "Shared action menu", "design": "Shared action menu",
"check": "scripts/menuConsistency.smoke.mjs" "check": "tests/smoke/menus/consistency.smoke.mjs"
}, },
"RuneStone/src/lib/layout/FileTree.svelte": { "RuneStone/src/lib/layout/FileTree.svelte": {
"counts": { "counts": {
"svelteMenu": 1 "svelteMenu": 1
}, },
"design": "Shared action menu", "design": "Shared action menu",
"check": "scripts/menuConsistency.smoke.mjs" "check": "tests/smoke/menus/consistency.smoke.mjs"
}, },
"RuneStone/src/lib/layout/QuickOpen.svelte": { "RuneStone/src/lib/layout/QuickOpen.svelte": {
"counts": { "counts": {
@@ -108,21 +108,21 @@
"localPopup": 3 "localPopup": 3
}, },
"design": "Shared searchable picker used by quick file open and document link picker", "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": { "RuneStone/src/lib/layout/TabBar.svelte": {
"counts": { "counts": {
"action": 1 "action": 1
}, },
"design": "Shared action menu", "design": "Shared action menu",
"check": "scripts/menuConsistency.smoke.mjs" "check": "tests/smoke/menus/consistency.smoke.mjs"
}, },
"RuneStone/src/lib/layout/Workbench.svelte": { "RuneStone/src/lib/layout/Workbench.svelte": {
"counts": { "counts": {
"action": 1 "action": 1
}, },
"design": "Shared action menu", "design": "Shared action menu",
"check": "scripts/menuConsistency.smoke.mjs" "check": "tests/smoke/menus/consistency.smoke.mjs"
}, },
"RuneStone/src/lib/layout/WorkspacePicker.svelte": { "RuneStone/src/lib/layout/WorkspacePicker.svelte": {
"counts": { "counts": {
@@ -130,21 +130,21 @@
"localPopup": 8 "localPopup": 8
}, },
"design": "Shared rich picker; paths retain a detail row", "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": { "RuneStone/src/lib/plugins/externalSession.ts": {
"counts": { "counts": {
"action": 1 "action": 1
}, },
"design": "Shared action menu", "design": "Shared action menu",
"check": "scripts/menuConsistency.smoke.mjs" "check": "tests/smoke/menus/consistency.smoke.mjs"
}, },
"RuneStone/src/lib/plugins/PluginAccessMenu.svelte": { "RuneStone/src/lib/plugins/PluginAccessMenu.svelte": {
"counts": { "counts": {
"svelteMenu": 1 "svelteMenu": 1
}, },
"design": "Shared action menu", "design": "Shared action menu",
"check": "scripts/menuConsistency.smoke.mjs" "check": "tests/smoke/menus/consistency.smoke.mjs"
}, },
"RuneStone/src/lib/plugins/sdk.ts": { "RuneStone/src/lib/plugins/sdk.ts": {
"counts": { "counts": {
@@ -159,7 +159,7 @@
"localPopup": 3 "localPopup": 3
}, },
"design": "Shared action menu", "design": "Shared action menu",
"check": "scripts/characterThemes.smoke.mjs" "check": "tests/smoke/appearance/characterThemes.smoke.mjs"
}, },
"RuneStone/src/lib/ui/actionMenu.ts": { "RuneStone/src/lib/ui/actionMenu.ts": {
"counts": { "counts": {
@@ -167,14 +167,14 @@
"localPopup": 2 "localPopup": 2
}, },
"design": "Shared action menu", "design": "Shared action menu",
"check": "scripts/menuConsistency.smoke.mjs" "check": "tests/smoke/menus/consistency.smoke.mjs"
}, },
"RuneStone/src/lib/ui/managedActionMenu.ts": { "RuneStone/src/lib/ui/managedActionMenu.ts": {
"counts": { "counts": {
"action": 2 "action": 2
}, },
"design": "Shared action menu", "design": "Shared action menu",
"check": "scripts/menuConsistency.smoke.mjs" "check": "tests/smoke/menus/consistency.smoke.mjs"
}, },
"RuneStone_Project_Management/src/choices-ui.ts": { "RuneStone_Project_Management/src/choices-ui.ts": {
"counts": { "counts": {
@@ -296,7 +296,7 @@
"nativeChoice": 1 "nativeChoice": 1
}, },
"design": "Host radio menu; native server select only on older hosts", "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": { "RuneStone_Git/src/view.js": {
"counts": { "counts": {
@@ -320,7 +320,7 @@
"localPopup": 1 "localPopup": 1
}, },
"design": "Shared action menu for interface language; settings retain ordinary controls", "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": { "RuneStone_Project_Management/src/workspace-default.ts": {
"counts": { "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: 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. - 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: Unit tests:
```powershell ```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: 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: Browser smoke tests mock desktop calls and use the real interface and module loader. Run them while `pnpm dev` runs:
```powershell ```powershell
node scripts/pluginInstall.smoke.mjs node tests/smoke/plugins/install.smoke.mjs
node scripts/plugins.smoke.mjs node tests/smoke/plugins/lifecycle.smoke.mjs
node scripts/pluginAccess.smoke.mjs node tests/smoke/plugins/access.smoke.mjs
node scripts/pluginChoiceMenus.smoke.mjs node tests/smoke/plugins/choiceMenus.smoke.mjs
node scripts/pluginFind.smoke.mjs node tests/smoke/find/pluginViews.smoke.mjs
node scripts/pluginTabOrder.smoke.mjs node tests/smoke/tabs/lastTabAndSiteIcons.smoke.mjs
node scripts/settings.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. `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 | | 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` | | `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 | `scripts/appearance.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 | `scripts/malfoidPalette.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`. `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. 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 | | 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 | | 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. 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.
+3 -2
View File
@@ -9,11 +9,11 @@
"build:installer": "node scripts/buildInstaller.mjs", "build:installer": "node scripts/buildInstaller.mjs",
"preview": "vite preview", "preview": "vite preview",
"prepare": "svelte-kit sync || echo ''", "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:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"check:menus": "node scripts/menuSurfaceAudit.mjs", "check:menus": "node scripts/menuSurfaceAudit.mjs",
"tauri": "tauri", "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", "build:plugins": "node scripts/buildPlugins.mjs",
"browser:check": "npm --prefix browser-runtime run check", "browser:check": "npm --prefix browser-runtime run check",
"browser:test": "npm --prefix browser-runtime test", "browser:test": "npm --prefix browser-runtime test",
@@ -55,6 +55,7 @@
"@sveltejs/kit": "^2.65.1", "@sveltejs/kit": "^2.65.1",
"@sveltejs/vite-plugin-svelte": "^7.1.2", "@sveltejs/vite-plugin-svelte": "^7.1.2",
"@tauri-apps/cli": "^2", "@tauri-apps/cli": "^2",
"@types/node": "24.19.2",
"svelte": "^5.56.3", "svelte": "^5.56.3",
"svelte-check": "^4.6.0", "svelte-check": "^4.6.0",
"typescript": "~6.0.3", "typescript": "~6.0.3",
+31 -15
View File
@@ -89,16 +89,19 @@ importers:
devDependencies: devDependencies:
'@sveltejs/adapter-static': '@sveltejs/adapter-static':
specifier: ^3.0.10 specifier: ^3.0.10
version: 3.0.10(@sveltejs/[email protected](@sveltejs/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected])) version: 3.0.10(@sveltejs/[email protected](@sveltejs/[email protected]([email protected])([email protected](@types/[email protected])))([email protected])([email protected])([email protected](@types/[email protected])))
'@sveltejs/kit': '@sveltejs/kit':
specifier: ^2.65.1 specifier: ^2.65.1
version: 2.70.3(@sveltejs/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected]) version: 2.70.3(@sveltejs/[email protected]([email protected])([email protected](@types/[email protected])))([email protected])([email protected])([email protected](@types/[email protected]))
'@sveltejs/vite-plugin-svelte': '@sveltejs/vite-plugin-svelte':
specifier: ^7.1.2 specifier: ^7.1.2
version: 7.3.0([email protected])([email protected]) version: 7.3.0([email protected])([email protected](@types/[email protected]))
'@tauri-apps/cli': '@tauri-apps/cli':
specifier: ^2 specifier: ^2
version: 2.11.4 version: 2.11.4
'@types/node':
specifier: 24.19.2
version: 24.19.2
svelte: svelte:
specifier: ^5.56.3 specifier: ^5.56.3
version: 5.57.1 version: 5.57.1
@@ -110,7 +113,7 @@ importers:
version: 6.0.3 version: 6.0.3
vite: vite:
specifier: ^8.0.16 specifier: ^8.0.16
version: 8.3.0 version: 8.3.0(@types/[email protected])
packages: packages:
@@ -730,6 +733,9 @@ packages:
'@types/[email protected]': '@types/[email protected]':
resolution: {integrity: sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==} resolution: {integrity: sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==}
'@types/[email protected]':
resolution: {integrity: sha512-93d49wCWJkCyN87MxLpNN6KXPCwFw7bVUg79mGUV1OS40JGWwVCr8n61DXCSqz7CV6/VfPkb7xec7uP2M+QHWQ==}
'@types/[email protected]': '@types/[email protected]':
resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==} resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==}
@@ -1321,6 +1327,9 @@ packages:
[email protected]: [email protected]:
resolution: {integrity: sha512-U3PppEkleoTnIfi8BozMx3yju3qc/L6SwqWo2Sw+54PX+PX0q9I+r1Um5HCmqD7n9VDX5/v3vQH/AjA6deDdtw==} resolution: {integrity: sha512-U3PppEkleoTnIfi8BozMx3yju3qc/L6SwqWo2Sw+54PX+PX0q9I+r1Um5HCmqD7n9VDX5/v3vQH/AjA6deDdtw==}
[email protected]:
resolution: {integrity: sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==}
[email protected]: [email protected]:
resolution: {integrity: sha512-xZe/16rV4aa+HGSOCiY2YeLT1OybRLrrkL/Rqaq7p7GMVXjFh+6wN4oMYgjFmnSnhY8t6Xpdl2l9qmnHYuMHwQ==} resolution: {integrity: sha512-xZe/16rV4aa+HGSOCiY2YeLT1OybRLrrkL/Rqaq7p7GMVXjFh+6wN4oMYgjFmnSnhY8t6Xpdl2l9qmnHYuMHwQ==}
hasBin: true hasBin: true
@@ -1617,15 +1626,15 @@ snapshots:
dependencies: dependencies:
acorn: 8.18.0 acorn: 8.18.0
'@sveltejs/[email protected](@sveltejs/[email protected](@sveltejs/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected]))': '@sveltejs/[email protected](@sveltejs/[email protected](@sveltejs/[email protected]([email protected])([email protected](@types/[email protected])))([email protected])([email protected])([email protected](@types/[email protected])))':
dependencies: dependencies:
'@sveltejs/kit': 2.70.3(@sveltejs/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected]) '@sveltejs/kit': 2.70.3(@sveltejs/[email protected]([email protected])([email protected](@types/[email protected])))([email protected])([email protected])([email protected](@types/[email protected]))
'@sveltejs/[email protected](@sveltejs/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected])': '@sveltejs/[email protected](@sveltejs/[email protected]([email protected])([email protected](@types/[email protected])))([email protected])([email protected])([email protected](@types/[email protected]))':
dependencies: dependencies:
'@standard-schema/spec': 1.1.0 '@standard-schema/spec': 1.1.0
'@sveltejs/acorn-typescript': 1.0.13([email protected]) '@sveltejs/acorn-typescript': 1.0.13([email protected])
'@sveltejs/vite-plugin-svelte': 7.3.0([email protected])([email protected]) '@sveltejs/vite-plugin-svelte': 7.3.0([email protected])([email protected](@types/[email protected]))
'@types/cookie': 0.6.0 '@types/cookie': 0.6.0
acorn: 8.18.0 acorn: 8.18.0
cookie: 0.6.0 cookie: 0.6.0
@@ -1637,20 +1646,20 @@ snapshots:
set-cookie-parser: 3.1.2 set-cookie-parser: 3.1.2
sirv: 3.0.2 sirv: 3.0.2
svelte: 5.57.1 svelte: 5.57.1
vite: 8.3.0 vite: 8.3.0(@types/[email protected])
optionalDependencies: optionalDependencies:
typescript: 6.0.3 typescript: 6.0.3
'@sveltejs/[email protected]': {} '@sveltejs/[email protected]': {}
'@sveltejs/[email protected]([email protected])([email protected])': '@sveltejs/[email protected]([email protected])([email protected](@types/[email protected]))':
dependencies: dependencies:
deepmerge: 4.3.1 deepmerge: 4.3.1
magic-string: 1.4.1 magic-string: 1.4.1
obug: 2.2.1 obug: 2.2.1
svelte: 5.57.1 svelte: 5.57.1
vite: 8.3.0 vite: 8.3.0(@types/[email protected])
vitefu: 1.1.3([email protected]) vitefu: 1.1.3([email protected](@types/[email protected]))
'@tauri-apps/[email protected]': {} '@tauri-apps/[email protected]': {}
@@ -2017,6 +2026,10 @@ snapshots:
'@types/[email protected]': {} '@types/[email protected]': {}
'@types/[email protected]':
dependencies:
undici-types: 7.24.6
'@types/[email protected]': '@types/[email protected]':
optional: true optional: true
@@ -2641,9 +2654,11 @@ snapshots:
[email protected]: {} [email protected]: {}
[email protected]: {}
[email protected]: {} [email protected]: {}
[email protected]: [email protected](@types/[email protected]):
dependencies: dependencies:
lightningcss: 1.33.0 lightningcss: 1.33.0
picomatch: 4.0.7 picomatch: 4.0.7
@@ -2651,11 +2666,12 @@ snapshots:
rolldown: 1.2.9 rolldown: 1.2.9
tinyglobby: 0.2.17 tinyglobby: 0.2.17
optionalDependencies: optionalDependencies:
'@types/node': 24.19.2
fsevents: 2.3.3 fsevents: 2.3.3
[email protected]([email protected]): [email protected]([email protected](@types/[email protected])):
optionalDependencies: optionalDependencies:
vite: 8.3.0 vite: 8.3.0(@types/[email protected])
[email protected]: {} [email protected]: {}
+2 -40
View File
@@ -1,40 +1,2 @@
import { readFile } from "node:fs/promises"; // RuneStone_Terminal imports this path for its smoke test. The helper lives in the shared smoke harness.
import { resolve } from "node:path"; export * from "../tests/smoke/_harness/pluginMocks.mjs";
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);
}
+40
View File
@@ -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);
}
@@ -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 } }); const page = await browser.newPage({ viewport: { width: 1440, height: 1000 } });
page.setDefaultTimeout(10000); page.setDefaultTimeout(10000);
const errors = []; 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("console", message => { if (message.type() === "error" || message.type() === "warning") console.log(message.type(), message.text()); });
page.on("pageerror", error => errors.push(error.message)); page.on("pageerror", error => errors.push(error.message));
await page.addInitScript(() => { await page.addInitScript(() => {
@@ -12,8 +12,8 @@ page.on('pageerror', error => errors.push(error.message));
const output = '.audit/host-privacy-find'; const output = '.audit/host-privacy-find';
await mkdir(output, { recursive: true }); await mkdir(output, { recursive: true });
const pm = { const pm = {
manifest: JSON.parse(await readFile(new URL('../../RuneStone_Project_Management/dist/plugin/plugin.json', 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'), code: await readFile(new URL('../../../../RuneStone_Project_Management/dist/plugin/main.js', import.meta.url), 'utf8'),
}; };
await page.addInitScript(({ pm }) => { await page.addInitScript(({ pm }) => {
window.isTauri = true; window.isTauri = true;
@@ -39,9 +39,9 @@ await page.addInitScript(() => {
window.__TEST__ = { state, emit }; window.__TEST__ = { state, emit };
}); });
try { 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); 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"]) { for (const permission of ["close", "minimize", "toggle-maximize", "start-dragging"]) {
assert.ok(capability.permissions.includes(`core:window:allow-${permission}`)); assert.ok(capability.permissions.includes(`core:window:allow-${permission}`));
} }
@@ -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. // Run against `pnpm dev`. PLAYWRIGHT_MODULE may point to a shared installation.
import { createRequire } from "node:module"; import { createRequire } from "node:module";
import assert from "node:assert/strict"; 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 } }); const page = await browser.newPage({ viewport: { width: 1440, height: 1000 } });
page.setDefaultTimeout(10000); page.setDefaultTimeout(10000);
const errors = []; 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("console", message => { if (message.type() === "error" || message.type() === "warning") console.log(message.type(), message.text()); });
page.on("pageerror", error => errors.push(error.message)); page.on("pageerror", error => errors.push(error.message));
await page.addInitScript(() => { await page.addInitScript(() => {
@@ -13,7 +13,7 @@ await page.route('**/__choice-audit__', route => route.fulfill({ contentType: 't
await page.route('**/__autocomplete__/*.mjs', async route => { await page.route('**/__autocomplete__/*.mjs', async route => {
const name = new URL(route.request().url()).pathname.split('/').pop(); const name = new URL(route.request().url()).pathname.split('/').pop();
assert.ok(['main.mjs', 'engine.mjs'].includes(name)); 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 { try {
for (const theme of ['light', 'dark']) for (const width of [1100, 390]) { for (const theme of ['light', 'dark']) for (const width of [1100, 390]) {
@@ -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. // Run against `pnpm dev`. PLAYWRIGHT_MODULE may point to a shared installation.
import { createRequire } from "node:module"; import { createRequire } from "node:module";
import assert from "node:assert/strict"; import assert from "node:assert/strict";
@@ -3,7 +3,7 @@ import { createRequire } from "node:module";
import { mkdirSync, readFileSync } from "node:fs"; import { mkdirSync, readFileSync } from "node:fs";
import assert from "node:assert/strict"; import assert from "node:assert/strict";
const require = createRequire(import.meta.url); 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 }); mkdirSync(".audit", { recursive: true });
const { chromium } = require(process.env.PLAYWRIGHT_MODULE || "playwright"); 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 browser = await chromium.launch({ headless: true, ...(process.env.CHROME_PATH ? { executablePath: process.env.CHROME_PATH } : {}) });
@@ -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 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"; const url = process.env.SMOKE_URL || "http://127.0.0.1:1420";
mkdirSync(".audit", { recursive: true }); 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-*"]); assert.deepEqual(settingsCapability.windows, ["settings-main", "settings-workspace-*"]);
for (const action of ["close", "minimize", "toggle-maximize", "start-dragging"]) { for (const action of ["close", "minimize", "toggle-maximize", "start-dragging"]) {
assert(settingsCapability.permissions.includes(`core:window:allow-${action}`)); assert(settingsCapability.permissions.includes(`core:window:allow-${action}`));
@@ -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. // Run against `pnpm dev`. PLAYWRIGHT_MODULE may point to a shared installation.
import { createRequire } from "node:module"; import { createRequire } from "node:module";
import assert from "node:assert/strict"; import assert from "node:assert/strict";
@@ -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. // Run against `pnpm dev`. PLAYWRIGHT_MODULE may point to a shared installation.
import { createRequire } from "node:module"; import { createRequire } from "node:module";
import assert from "node:assert/strict"; import assert from "node:assert/strict";
@@ -8,7 +8,7 @@ const context = await browser.newContext({ viewport: { width: 1200, height: 850
const page = await context.newPage(); const page = await context.newPage();
const errors = []; const errors = [];
page.on('pageerror', error => errors.push(error.message)); 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 = { const git = {
manifest: JSON.parse(await readFile(new URL('plugin.json', gitRoot), 'utf8')), manifest: JSON.parse(await readFile(new URL('plugin.json', gitRoot), 'utf8')),
code: await readFile(new URL('main.js', gitRoot), 'utf8'), code: await readFile(new URL('main.js', gitRoot), 'utf8'),
+11
View File
@@ -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": []
}
@@ -1,8 +1,8 @@
import test from "node:test"; import test from "node:test";
import assert from "node:assert/strict"; import assert from "node:assert/strict";
import { ContributionRegistry } from "../src/lib/plugins/registry.ts"; import { ContributionRegistry } from "../../../src/lib/plugins/registry.ts";
import { ExternalSession } from "../src/lib/plugins/externalSession.ts"; import { ExternalSession } from "../../../src/lib/plugins/externalSession.ts";
import type { PluginApi } from "../src/lib/plugins/sdk.ts"; import type { PluginApi } from "../../../src/lib/plugins/sdk.ts";
test("browser contributions and view updates are revoked when the plugin stops", async () => { test("browser contributions and view updates are revoked when the plugin stops", async () => {
const registry = new ContributionRegistry(); const registry = new ContributionRegistry();
@@ -1,7 +1,7 @@
import test from "node:test"; import test from "node:test";
import assert from "node:assert/strict"; import assert from "node:assert/strict";
import { SearchQuery } from "@codemirror/search"; 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", () => { test("document search uses Writer word matching and normalized CRLF positions", () => {
const query = new SearchQuery({ search: "Alpha", wholeWord: true, caseSensitive: true }); const query = new SearchQuery({ search: "Alpha", wholeWord: true, caseSensitive: true });

Some files were not shown because too many files have changed in this diff Show More