yoshida yoshida
Open the editor

Docs Contribute

Testing

On this page

There are five kinds of checks. CI runs all of them (see CI and Deployment).

Core: zig build test

Unit tests inside the Zig sources: parsers, the formatter, the loader, expressions and rendering.

Examples

zig build
./zig-out/bin/yoshida fmt --check examples
./zig-out/bin/yoshida check examples/poker
./zig-out/bin/yoshida render examples/poker --offline --out out/poker

The examples must be in canonical format (yoshida fmt examples/<name> fixes them), check without errors and render.

Editor unit tests: npm run test:unit

Run in web/. These need no browser, only the built WASM modules (npm run wasm).

FileCovers
tests/export-plan.mjsthe export dialog's plan: file names, ZIP or one file, the summary line, stored settings, each design's scale, size and dpi (by scale or by target dpi), the pixel limit, the JPEG dpi
tests/expr-core.mjsthe expression core: tokens, problems, tree, templates, formatter
tests/expr-edit.mjsedits made by the formula panel
tests/expr-rewrite.mjsthe quick actions on expressions
tests/filetypes.mjsfile kinds and descriptions in the Files tab
tests/components.mjscomponents in the builder: filling includes in, splitting edits back into files, detached copies
tests/fonts.mjsfont readers and the Google Fonts catalog
tests/hexcolor.mjsthe hex colour helper against the core's rules
tests/progress-math.mjsexport progress and time left

Run one with the command at the top of the file, for example node tests/expr-core.mjs.

Editor end-to-end tests: npm run test:ui

Chromium driven by Playwright against the built editor. test:ui (tests/run-ui.mjs) runs every tests/ui*.mjs file one after another and lists every file that failed at the end; CI runs three groups in parallel with --shard 1/3. Run a single file while you work:

cd web
npx playwright install chromium   # once; npm ci does not download a browser
npm run wasm && npm run examples && npm run build
npx vite preview --port 4173 --strictPort &
node tests/ui-organise.mjs http://localhost:4173/
FileCovers
ui.mjsthe editor in a real browser: loading, editing, saving, reload
ui-organise.mjsparam groups, the Files tab, the card browser, splitters, list rows
ui-view.mjszoom, pan and keeping the card in view
ui-features.mjsrepeat groups, design functions, enum lists, PDF export, strokes, preset shapes
ui-hover.mjshover info and go to definition in expression fields
ui-review.mjslist fields, tabs, tooltips, export progress, rendering on the server
ui-perf.mjsproxy renders and export progress on the board game
ui-expr.mjsthe expression editor: marks, breadcrumb, wrapping, reformat
ui-paths.mjsJSON pointers of the inspector fields
ui-formula.mjsthe formula editor window
ui-fonts.mjsthe Fonts window, Google Fonts import, uploads
ui-rename.mjsrenaming fonts and design functions
ui-files.mjsthe Files panel layout on a short window
ui-export.mjsthe quick PNG / ZIP / PDF buttons and the export dialog: keyboard, one card as JPEG at 2x, a design as PNG + JPEG, all designs, vector and image PDF with and without crop marks, 16-bit PNG, WebP, remembered settings, one card as SVG compared with its PNG, a design as SVG, the target dpi and the resolution slider, the resolution limit, designs with and without a dpi
ui-file-types.mjsthe Files tab: icons per file kind, selected file details, upload target, size column
ui-components.mjscomponents (create, include, edit in place, detach, duplicate) and colour tags

A failed run writes screenshots to web/test-results/; CI uploads them as the ui-test-results artifact. When you change an example, update the tests that read it: several look for specific cards, layers and values of the poker and board game examples.

Website

cd site && zola build --output-dir ../public fails on a broken internal link or anchor.

↑↓ to moveEnter to openEsc to close