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.
  • warnings.test.ts: what prose check finds, at its place in the file.
  • presence.test.ts: a file, folder or export with no prose, and what isn't asked.
  • structure.test.ts: links that reach nothing, headings that skip a level, and prose on the marker's line.
  • style.test.ts: the advice prose style gives, and what looks like a break but isn't.
  • codes.test.ts: every code check and style print has a row in the docs, and every row a code. prose rules reads the same rows.
  • stylesheet.test.ts: every rule in the stylesheet sits in a layer.
  • outline.test.ts: the map prose outline writes, its links and what it leaves out.
  • cli.test.ts: the command's exit codes, streams, summary and flags, run on the built command.
  • accent.test.ts: a project's colour and tab icon, and the browser's bar in the paper's colour.

Two checks need a browser, so they run in the browser workflow, not with the rest, and pnpm run test:browser runs both. axe.ts is the accessibility audit. keyboard.ts reads pages by 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 test:browser, which the browser workflow runs when package.json changes, as a release does (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.

  • cli.test.ts

    What the command promises a script or CI: the exit codes, which stream each line goes to, the summary by code, the line that names prose rules, and the count it always ends with. Each runs the built command on a small repository, so the file builds it first.

  • codes.test.ts

    Holds the code tables in usage and the codes the source emits to the same ids, both ways, so a code can't ship without a row, and a row can't outlive its code.

  • 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 test:browser, which the browser workflow runs when package.json changes, as a release does (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. A folder in the list links its page. Names that aren't docs or folders are skipped, with a warning.

  • outline.test.ts

    What prose outline writes: the tree, each file's summary on its line, a folder's from its README, links made from the root, and what .gitattributes leaves out.

  • parser.test.ts

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

  • presence.test.ts

    prose's warnings on prose that isn't there. That's a file with no @prose, a folder with no README.md, and an export a library ships with no comment. Each runs on a small repository, with the files and folders that must not be asked beside it.

  • 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 Playwright's Chromium.

  • structure.test.ts

    prose's warnings on how a text is put together. That's links that reach nothing, headings that skip a level, @prose sharing its line, a summary with no title, and a written id that isn't kebab case or is stated on two pages. Each is run on a small repository, with the near misses that must not warn beside it.

  • style.test.ts

    Where a text's style breaks the plain-sentence rules, and the forms that look like a break but aren't, like a list item's label, an abbreviation or a short gloss. A task gets advice when it's ticked or long. Then the advice on a repository's files, at each one's own line, leaving out what isn't checked.

  • stylesheet.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.

  • warnings.test.ts

    What markz and prose report about a repository's text, at the file's own line and column. The one-line form check and build print, the files .gitattributes leaves out and how many, and the list at the foot of a local page that a built page never has.

No prose yet

__snapshots__/