Test harnesses in @meridian-ts/test-support
A new package @meridian-ts/test-support has one harness for each HTML part.
Context
The tests of the guide, the test app and the stories found elements with CSS selectors and
MapLibre class names. A change of markup then breaks many tests, and an application that uses
Meridian has no tested way to drive its maps. The sibling library Lattice ships harnesses on
harnessed (@harnessed-ts/core).
A map has two kinds of parts:
- HTML parts: markers, popups, controls, the place search and the route steps. A harness finds them by their role and accessible name, and acts on them as a person does.
- Canvas parts: sources, layers, clusters, the route line, the draw shapes and the deck.gl layers. They are pixels in a WebGL canvas. No DOM query can read them.
Decision drivers
Not recorded in the original ADR.
Options considered
Not recorded in the original ADR.
Decision
A new package
@meridian-ts/test-supporthas one harness for each HTML part. It is plain TypeScript, built with tsup, so the standard decorators are compiled in the package. An application needs no Babel plugin, and the harnesses run with each harnessed driver.Each harness finds its host by role and accessible name only:
Harness Host MapHarnessthe map canvas, region"Map"MarkerHarnessbutton"Map marker"PopupHarnessdialog"Map popup"NavigationControlHarnessbutton"Zoom in"GeolocateControlHarnessbutton"Find my location" or "Location not available"FullscreenControlHarnessbutton"Enter fullscreen" or "Exit fullscreen"GlobeControlHarnessbutton"Enable globe" or "Disable globe"TerrainControlHarnessbutton"Enable terrain" or "Disable terrain"PlaceAutocompleteHarnesscombobox(any name, or the name that the test gives)GeocoderControlHarnesscombobox"Search places"DirectionsStepsHarnesslist"Route steps"Two components get the ARIA that the table needs.
<map.Popup>gives the popup elementrole="dialog"and the name "Map popup" (@labelchanges it).<DirectionsSteps>gives its list the name "Route steps" (aria-labelchanges it). This also helps screen reader users.The labels are the English defaults of MapLibre. A test of a map with another
localegives the names to the harness.Canvas parts have no harness. Their tests read the map instance (
getLayer,getSource,getPaintProperty,queryRenderedFeatures) next to the harness calls.Amended (2026-12-03): the guide samples assert only through harness methods and
@harnessed-ts/should. SoMapHarnesshaslayerType(map, id)andzoom(map), which read the map instance that the test gives. They work only when the test and the map are in the same process (QUnit, a Jig story), not in Playwright. Other canvas reads stay on the map instance.ScaleControlandAttributionControlshow text with no role, so they have no harness either; their tests useassert.dom.The test app, the guide tests and the Jig story play functions use the harnesses (
@harnessed-ts/emberin QUnit,@jig-ts/harnessedin stories).
Consequences
- A markup change inside a component changes its harness only, not each test.
- An application can drive a Meridian map in its own tests with the same harnesses.
- Canvas assertions stay tied to the MapLibre API. This is a limit of a WebGL map, not of the harnesses.
Findings while the harnesses were built
- MapLibre changes the
titleof a toggle button (globe, terrain, fullscreen) and keeps the firstaria-label. A screen reader then reads the old name, for example "Enable globe" while the globe shows. The harnesses read the state fromtitle. Report this to MapLibre. - The harnessed Ember driver runs on Ember 5.12, so the harness tests are in the plain suite that CI runs on 7.3, 6.12 and 5.12.
- The guide app keeps its own harness (
docs-app/tests/harnesses/guide.harness.ts) for the guide header, navigation and content. Its harness files are a TypeScript project of their own (tsconfig.harness.json), and@harnessed-ts/core/babelcompiles them, because the app compiles its own decorators in the legacy form.
Confirmation
Not recorded in the original ADR.
Interview record
Each question of the interview with its answer and its source. A fact from the code or a document, a question that the author did not ask, and an assumption are rows too.
| Question | Answer | Source |
|---|---|---|
| Where does the text of this page come from? | From the Markdown file docs/adr/0013-harnesses.md at commit ece53da. The text of each section is the text of the Markdown file. A section that the Markdown file does not have says so. | Document: docs/adr/0013-harnesses.md |
Changelog
| Date | Author | Change |
|---|---|---|
| 2026-12-02 | Joe Gaudet | Status in the Markdown file: Accepted (2026-12-02). |
| 2026-12-02 | Joe Gaudet | Commit fa9b0fd: Test harnesses for Meridian (#3) |
| 2026-12-03 | Joe Gaudet | Commit 665a4fc: docs: assert with should matchers in the testing guide (#5) |
| 2026-12-04 | Joe Gaudet (agent) | Converted from docs/adr/0013-harnesses.md to this page. The text is the text of the Markdown file. |
The adr skill of skillsaw wrote this page. The HTML in this file is the source of truth. The diagrams are the Mermaid sources in it.