How amateur or newbie Do regress Testing with Newer Typst?

No matter your packages and templates are on or off Typst Universe , it is important to know whether or not there are something different with multiple versions of Typst. Besides the Changelog of newer Typst release,

firefox https://typst.app/docs/changelog/
# online or offline to view the Changelog
gh release download -p "*.pdf" --repo typst/typst
firefox *.pdf  # chapter 5 Changelog

you’d better compile your.typ again to ensure that everything is fine. For

the Primary

, why not compare images? (via diffimg and ImageMagick, both are shiped within vanilla Debian)

typst-0151 c my.typ a.png
typst-0142 c my.typ b.png

# Linux Debian/Ubuntu or Microsoft WSL
# Methond 1: Only the Diff
diffimg a.png b.png diff.png
firefox *.png

# Method 2: Highlight the Diff on Image
magick compare a.png b.png diff-highlight.png

# Method 3: Flicker two Images as GIF
magick -delay 50 a.png b.png -loop 0 diff-flicker.gif

# And for Multi-Page, e.g. four pages as gif:
typst-0151 c my.typ a-{0p}.png
typst-0142 c my.typ b-{0p}.png
magick montage a-*.png -geometry +2+2 a-all.png
magick montage b-*.png -geometry +2+2 b-all.png
magick -delay 50 *all.png -loop 0 diff-multi-page.gif

the Junior

, learn and use Tytanic package

gh repo read-file docs/book/src/README.md --repo tingerrr/tytanic
// or offline, depth=1 to clone the latest git commit only
git clone --depth 1 git@github.com:tingerrr/tytanic.git

the Senior

, just do testing as Typst do,

gh repo read-file tests/README.md --repo typst/typst
// or offline, it's not big, only 29MB or so
git clone --depth 1 git@github.com:typst/typst.git

if a git repo is big, you could download part of it, i.e. a sub-folder, that’s called “git sparse clone.” Git Docs and Typst Packages Example to learn more.

Testing strategies

There are currently two approaches to testing output in the test suite.

File references

File references store the expected output directly inside the ref directory
and are committed to this repository. Newly produced output is compared to the
expected reference in order to determine if a test fails or passes.

Hashed references

Hashed references only store a hash of the expected output inside a
ref/{format}/hashes.txt file, which is committed to this repository. This is
mainly done to prevent repository bloat; each hash takes up only 32 bytes of
storage space, no matter how large the output file. When a test is run, its
output is hashed using the same stable hash function and compared to the
reference hash.

2 Likes