Index

mmo-js-tests

1 symbol · generated 30 Sep 2026

element

mmo-js-tests

mmo-js-tests.jhs:1

The javascript test suite, run from the page.

<mmo-js-tests filter="" auto></mmo-js-tests>
Extends
CustomShadowElement
It is a face for `tests/js-node/run.js`, reached through `MMO\client\controllers\TestsController`: the picker is the runner's `--list`, the Run button is its `--json` mode, and what is drawn below is the report it printed. No test runs in this page -- they run in node, on the server, against the sources rather than against the bundle this page is painted by, which is the whole point: a test that passed here because the page happened to have the right globals would be worthless. The element draws a hint and nothing else when the application did not register that controller, so a page can carry it unconditionally. ### Reading a result A suite is a file, a row is one `test*` method. A failure shows the assertion's own message -- expected against actual, as the assertion wrote it -- and, when it was a crash rather than an assertion, the stack. Anything a test printed on the console is captured by the runner and hangs under the test that printed it, rather than being interleaved into one stream nobody can attribute. A file is collapsed to one line -- its name, its counts, its time -- and opens on a click. What failed opens on its own, and stays open when it is re-run, so the report is a short list that grows only where someone asked it to. **Expand** opens or closes every file at once, and **Failures** narrows the list to what failed, files included: between them, 356 tests read as 17 rows. ```html <mmo-js-tests></mmo-js-tests> <!-- open on one namespace, and do not run until asked --> <mmo-js-tests filter="MMO.tests.core.Map" auto="false"></mmo-js-tests> ```

Index

filterthe namespace the picker opens on; empty means all of them
autorun once, on connect.
constructor()
init()
message(state, message)Set the strip's state and its message.
request(path, method, body)Call one of the controller's routes.
load()Read the namespaces the suite holds, and fill the picker.
run(namespace)Run the suite, or the one namespace given.
setReport(report)Draw a report.
toggleAll()Open or close every file at once.
toggleFailures()Show every test, or only what failed.

Attributes2

filter

mmo-js-tests.jhs

the namespace the picker opens on; empty means all of them

filter=""

auto

mmo-js-tests.jhs

run once, on connect. Write auto="false" to wait for the button.

auto

Methods9

message(state, message)

mmo-js-tests.jhs:157

Set the strip's state and its message.

message(state, message)
statestring- '', 'busy', 'ok' or 'error'; it is also the css class
messagestring

request(path, method, body)

mmo-js-tests.jhs:173

Call one of the controller's routes.

request(path, method = 'GET', body = null)A failing *test* is a 200 with a report; only the runner failing is an error status, and the server's own message is what explains it (a missing node, a missing jsdom), so it is read out of the body rather than replaced by the status text.
pathstring- jsTests or jsTestsRun
method = 'GET'string
body = null?object
returnsPromisethe route's payload

load()

mmo-js-tests.jhs:194

Read the namespaces the suite holds, and fill the picker.

load()
returnsPromise

run(namespace)

mmo-js-tests.jhs:219

Run the suite, or the one namespace given.

run(namespace = null)
namespace = null?string- what to run; the picker's own value when omitted
returnsPromise

setReport(report)

mmo-js-tests.jhs:248

Draw a report.

setReport(report)Every value the markup binds is computed here rather than in the template: a `status` class per suite and per test, and the summary line. The report itself is never mutated.
reportobject- what run.js --json printed
returnsvoid

toggleAll()

mmo-js-tests.jhs:301

Open or close every file at once.

toggleAll()The state is written into the model rather than onto the nodes, so it survives the `only failures` filter and anything else that re-reads the view.
returnsvoid

toggleFailures()

mmo-js-tests.jhs:316

Show every test, or only what failed. The filtering is a class on the host, so it costs no re-render: a report of 356 rows is drawn once and narrowed by css.

toggleFailures()
returnsvoid