mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-09-27 12:47:54 +00:00
Moves 290 root test-*.js into tests/unit (177, listed in test-all.sh) and tests/e2e (113, classified in scripts/non-unit-tests.json), per #1981 and PR-D of #1385. Root goes from 348 entries to 48. test-all.sh and test-fixtures/ stay put. The inventory guard now fails if a test reappears in the root or sits in the wrong folder.
Verified independently of the diff: the invoked sets are unchanged (test-all.sh 177 before and after, deploy.yml 96 before and after, both identical as sets), and a full local run of test-all.sh on master and on the branch produced 4702 output lines each whose only differences are absolute paths, stack-trace line numbers shifted by the REPO_ROOT line, the inventory wording and two perf ratios. The guard was mutation-checked: a test back in the root, a unit suite in tests/e2e, and a suite dropped from test-all.sh each make it exit 1. CI run 35246304316 ran 97 suites from tests/e2e and is green.
Follow-up 9335c51d finished the instruction files: no bare root test command is left in AGENTS.md, the squad charters, .github or docs, and every tests/ path they name resolves.
Merged by the interim maintainer without a second human reviewer: CI and the local runs above are the independent checks.
Known and deliberately out of scope: 18 of the 113 files in tests/e2e are invoked by no runner at all, and one of them cannot run anywhere because it requires jsdom, which is not a declared dependency. Tracked separately.
37 lines
2.1 KiB
Markdown
37 lines
2.1 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.
|
|
|
|
Tests live in `tests/unit/` (standalone Node, run by `test-all.sh`) and
|
|
`tests/e2e/` (needs a browser, a server or extra tooling). They run from the
|
|
repo root, and refer to it as `REPO_ROOT`. When adding a `test-*.js` file:
|
|
|
|
1. If it runs standalone, put it in `tests/unit/` and add its
|
|
`node tests/unit/test-name.js` command to `test-all.sh`.
|
|
2. Otherwise put it in `tests/e2e/` and 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 tests/unit/test-test-inventory.js`. The guard rejects `test-*.js`
|
|
files in the repo root, 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.
|