Repository navigation
Better test runner - #3922
Merged
Merged
Better test runner#3922
Conversation
This was referenced Apr 13, 2024
Contributor
|
For anyone seeing this, you will need to manually clean/remove the old png folder to get new test runner working. And also that previously you run specific test by specifying the typ file name, now you should run by specifying the test_case_name which is the test case as in the typ file. And so you should do This should apply to anyone that has a working copy of the repo before this PR is merged. New afresh repo should be fine, |
laurmaedje
added a commit
that referenced
this pull request
May 16, 2024
laurmaedje
added a commit
that referenced
this pull request
May 17, 2024
Merged
Dikluwe
pushed a commit
to Dikluwe/typst-crystalline
that referenced
this pull request
Sep 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR rewrites the test runner from scratch and refactors the test suite. Here are the main changes:
All 1967 tests now have unique names. The names reflect the intent of the tests to make them easier to understand. They are also used for the reference images. The format is
--- {name} ---followed by the test, e.g.:There is now one reference image per individual test rather than one per test file. This means that tests don't need to be split up awkwardly anymore just to prevent an overlarge reference image.
The test-helper VS Code extension was updated to provide a per-test code lens that can be used to View, Run, and Save the test or to run it in the terminal.
The test runner now automatically detects whether a test has visual output and requires a reference image if and only if it does. There is no
// Ref: falseanymore.The runner's output is much more helpful. It points to concrete source locations in the test when there are failures and detects when just the range or message of an error is mismatched, but not both. For example
now yields
The resolution of the reference images was reduced from 2 pixels per point to 1 pixel per point. For the comparison itself that's enough and it's also still enough resolution to see what's going on. If a higher resolution is useful during development, the test runner's new
--scaleflag can be used. The reason for the lower resolution is to prevent repository bloat. With the smaller size and some changes to exceptionally large tests, the full reference image suite is brought down to 2.5 MiB at the time of writing. Through the change to images per test rather than per test file, the amount of data added to the git history in the future should be additionally lowered.To ensure that no overlarge reference images slip in, the test runner enforces a maximum reference image size of 20 KiB. If this limit is exceeded, it's typically possible to adjust the test to make it smaller without too much problems. If truly necessary, the limit can however be lifted by adding
// LARGEas the first line of a test.The test suite was reorganized, merging previously separate files, bringing the tests more in line with changes to the code base, and cleaning things up in general. The test harness was moved from
typtosuite. The output directories were moved into a sharedstoredirectory.The runner now has more robust handling for when a test is stuck in an endless loop or panicked and points to the concrete problematic test.
The test runner only accepts
--update, notUPDATE_EXPECTanymore. When used just once, the variable doesn't really make much sense over a flag, and permanently being in the updating state does not make sense at all.Autocompletion tests were migrated to normal Rust unit tests in the
typst-idecrate. It turns out that this approach is actually much simpler and more flexible than maintaining separate test syntax just for that. The small bit of new infrastructure intypst-idealso makes it easy to test other functionality like tooltips, etc. in the future.