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:
+5
-5
@@ -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 |
|
||||
|
||||
Reference in New Issue
Block a user