prose

Tests

One test file for each source file that has logic, run with pnpm run test. The build and server tests run against fixtures/simple, a small committed project, because prose build reads HEAD. It's a counter on one static page, with file prose in all three files and headed comments, so it covers the parser and every kind of page.

  • parser.test.ts: what counts as prose in each language.
  • highlight.test.ts: the HTML the highlighter writes, and a token or two in each language.
  • lexer.test.ts: what can hide a comment in JS and TS, and agreement with oxc's parser on the repository's own files.
  • tree.test.ts: the walk, summaries, and which files are read.
  • server.test.ts and build.test.ts: the pages and the static site.
  • repo.test.ts: the project's name and GitHub address, and the rail's footer and README rows.
  • nav.test.ts: the docs linked in the bar.
  • style.test.ts: every rule in the stylesheet sits in a layer.
  • accent.test.ts: a project's colour and tab icon, and the browser's bar in the paper's colour.

Two checks need Chrome, so they run by hand before a release, not with the rest. axe.ts is the accessibility audit, pnpm run axe. keyboard.ts reads pages by keyboard, pnpm run keyboard. Both build and serve the site through site.ts.

Commit a change to the fixture before running them, since a build exports HEAD.

Folders

  • fixtures/

    Small projects the tests read as an outside repository would. Each is committed, since prose build reads HEAD; simple is the one in use.

Code

  • accent.test.ts

    A project's hue and tab icon, and the page's head that carries them. The browser's bar takes the stylesheet's paper colours, so the two can't drift apart.

  • axe.ts

    Runs axe on every page of this repository's site, in light and dark, at a desktop and a phone width. It prints each rule that fails, with where, and exits non-zero if any does. Run it with pnpm run axe before a release (development).

  • build.test.ts

    prose build, run on tests/fixtures/simple and on a throwaway git repository. Every page must match the server's, less the live parts. The build must clear only an output folder it made.

  • highlight.test.ts

    The HTML the highlighter writes, and cases in each language with the colours shiki gave them.

  • keyboard.ts

    Reads a few pages of this repository's site with the keyboard alone, at a desktop and a phone width. It prints each thing that fails, with where, and exits non-zero if any does. Run it with pnpm run keyboard before a release (development).

  • lexer.test.ts

    The constructs that can hide a comment or fake one, and a check that the lexer finds the same comments as oxc's parser in every JS and TS file in the repository. oxc comes with vite-plus, so it costs no dependency.

  • nav.test.ts

    The docs linked in the bar. A nav list in docs/README.md sets their order, and without one every doc is linked in alphabetical order. Names that aren't docs are skipped, with a warning.

  • parser.test.ts

    What counts as prose in each language, and the one placement rule they share. The rules are writing.

  • repo.test.ts

    The project's name and GitHub address, read from a remote in each of its spellings. Also the rail's footer, and a folder's README.md row, which comes first and stands for the folder's page.

  • server.test.ts

    The pages prose . serves (reading), mostly for tests/fixtures/simple. Also the links between comments, the table of contents and live reload. Requests go out raw, so a path like /../x arrives as written and must be refused.

  • site.ts

    What the browser checks share. They build the site from HEAD with the renderer in dist/, and serve it to a page in the Chrome installed on the machine, so nothing is downloaded. The page asks for http://site/…, and each request is answered from the built files as a static host would answer it, so no server runs.

  • style.test.ts

    Every rule in the shipped stylesheet sits in a cascade layer. A rule outside one would beat every layer, and no page would show the mistake at once (style.css).

  • tree.test.ts

    The walk into folders and files (reading), run on throwaway projects in a temporary folder. It covers summaries, which files are read for prose, and the file list git gives.