Files
meshcore-analyzer/docs/frontend-testing.md
T
n30nex cd9b4c04d0 test: unify frontend test runs and prevent inventory drift (#1965)
Make `test-all.sh` the authoritative standalone frontend runner for npm
and CI. Restore stale assertions and reject missing, duplicate, removed
or undocumented inventory entries.

Fixes #1858.

Rebased onto `a2f039d4`. Retains release-routing, map scope-state and
Scope Audit stylesheet tests, adds `test-packets-local-channels.js` to
the sorted runner, and classifies `test-neighbor-map-btn-clip-e2e.js`
under browser. Its separate CI browser step is preserved. Inventory: 280
root suites, 167 standalone, 113 requiring separate setup.

The icon repair fixes two suites red on master:
`test-issue-1648-m2-emoji-scan.js` and
`test-issue-1648-m6-final-sweep.js`. Node/live configured-scope
confirmations now use the existing accessible Phosphor check sprite.
Values, visibility conditions and scanner assertions are preserved.

- Red evidence: `89e45a9` inventory assertions; `4e255df` accessible
confirmation assertion. The latest rebase also reproduced both
unclassified-file failures before adding their entries. This follow-up
only changes runner/classification configuration and counts; no test
files modified.
- Local validation: all 167 standalone suites; 27 M2 browser checks and
16 neighbor geometry checks in Chromium. Syntax, whitespace, PII,
CSS-variable and XSS checks passed.
- Browser coverage includes populated/empty/null configured scopes in
node and live views.
- No new dependencies, requests, application settings or Go changes.
Workflow outside the unit step matches master.
- Windows validation uses process-local UTF-8 settings. Encoding and
node-reach confirmation follow-ups remain separate, as requested.

## Preflight override

External `run-all.sh` is unavailable; applicable repository checks were
run directly.
2026-09-13 19:19:39 +02:00

33 lines
1.8 KiB
Markdown

# Frontend tests
`test-all.sh` is the authoritative list of standalone frontend suites. Both
`npm run test:unit` and the CI **Run JS unit tests** step invoke it. `npm test`
and `npm run test:coverage` wrap the same runner with coverage reporting.
The inventory currently covers 280 root suites: 167 standalone suites in the
runner and 113 suites classified separately by their prerequisites.
Run `npm run test:unit` from a checkout with Node.js, a POSIX shell, Bash, and
Python 3 available. The XSS gate's fixture test uses Bash and Python. On
Windows, use Git Bash and ensure `python3` resolves to Python 3 rather than a
Microsoft Store alias; set `PYTHONUTF8=1` for the gate's Unicode output.
No server or browser is started by this runner.
When adding a root `test-*.js` file:
1. Add its `node test-name.js` command to `test-all.sh` if it runs standalone.
2. Otherwise add it to `scripts/non-unit-tests.json`, with a prerequisite or
reason explaining why it belongs outside the unit runner. Browser suites
still need explicit selection in the E2E workflow to become CI gates.
3. Run `node test-test-inventory.js`. The guard rejects unclassified files,
duplicate assignments, removed files left in a list, undocumented groups,
and local/CI entry points that bypass the unit runner.
The separate inventory distinguishes plain Node Playwright scripts, suites
requiring the `@playwright/test` runner, and the `jsdom` integration suite.
Those last two dependencies are not currently declared in `package.json`;
classification records that limitation rather than installing them implicitly.
The existing E2E workflow retains its browser installation, local fixture
server, coverage collection, and repeat checks. Only use local servers for
browser tests; inventory membership alone does not mean a suite runs in CI.