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
+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.