scmJS docs

Tests

Unit tests#

Tests are tests/*.test.ts (and any src/**/*.test.ts), run by vitest in Node with no browser. The whole suite takes a few seconds.

The suites open two sets of map files:

Two suites are worth knowing about:

Browser tests#

e2e/*.spec.ts are Playwright specs that drive the built editor in headless Chromium. They cover what the unit tests cannot: that the bundle starts, that each dialog's chunk loads and mounts, and that a change made through the chrome ends up in the saved file.

npx playwright install chromium       # once
npm run build                         # the specs run against dist/
npm run test:e2e
npx playwright test e2e/save.spec.ts  # one file
npx playwright test --ui              # watch a spec run, step through it

npm run test:e2e serves dist/ with vite preview on port 4173 and does not build, so build again after changing the editor. To run against something already being served, the dev server included, set SCMJS_E2E_URL to its address.

Every spec runs under the same conditions, set up in e2e/support/editor.ts, so a run on a machine with game data is the run CI makes:

A test also fails if the page threw or logged an error.

Spec Checks
boot.spec.ts A first visit: splash, editor, the Game Data offer, a blank map drawn
dialogs.spec.ts Every dialog opens, in English and Korean
save.spec.ts A map renamed and saved; every other section comes back byte for byte
errors.spec.ts A dialog whose chunk fails closes with a notice; the editor carries on
dataPage.spec.ts The Game Data page on its own
installPage.spec.ts The page that installs game data for another page of the site
moveIn.spec.ts Settings kept at the old address are brought over on the first visit
pluginUpdates.spec.ts Checking all plugins for updates, and Update all
docks.spec.ts Dragging a dock's edge over a plugin's map view
rulers.spec.ts The rulers line up with the map past the scrollbars

dialogs.spec.ts reads the dialog ids from the registry, so a new dialog is covered without touching the spec; one that renders nothing without a payload must be added to its NEEDS_PAYLOAD list. A failure leaves a trace under test-results/; npx playwright show-trace <trace.zip> replays it. CI runs the specs in the web build and keeps the report of a failed run.

scmJS 0.20.0 + main@c323d11 · Generated from the repository. The source is under the MIT license, which does not cover what ATTRIBUTION.md lists. StarCraft and Brood War are trademarks of Blizzard Entertainment; this project ships none of their data.