Test infrastructure
This page covers the test setup scaffold writes and how to run and configure it. For which files a sync rewrites, see Infrastructure and template sync. For the standards these checks enforce, see Package standards.
The test tree
test/runtests.jl(package-owned) runs every@testitemthrough TestItemRunner.test/package/quality.jl(managed) holds the quality testset.test/package/qa_config.jl(package-owned) holds your package's settings for it.test/jet/andtest/formatter/(managed runners, package-owned config) are separate environments for JET and Runic.test/Project.toml(package-owned) is the test environment.
Put your own tests anywhere under test/ as further @testitems.
TestItemRunner and @testitem
TestItemRunner finds each @testitem by walking test/, so no file lists the tests. test/runtests.jl selects items by tag through test arguments.
No argument runs everything except AD-tagged items (see AD tooling).
skip_qualityskips the:qualityitems.quality_onlyruns only the quality testset.readme_onlyruns only:readmeitems.
Why discovery is limited to test/
The managed JuliaTestItems.toml at the package root limits discovery to test/**. A worktree checked out inside the repo therefore adds no test items and no @testsnippets. Snippets register globally by name and the last one wins, so a stale copy would shadow the real one. An item filter cannot prevent this because it runs after discovery and never sees snippets. The VS Code extension reads the same file, so the editor lists the same tests Pkg.test runs.
The quality testset
Each check in test/package/quality.jl is a :quality @testitem that calls a kit helper.
test_aquafor ambiguities, unbound type parameters, stale dependencies and other Aqua checks.test_explicit_importsso every used name is imported explicitly.test_import_centralisationsousingandimportsit in the module file.test_docstring_formatfor the docstring conventions.test_readme_sectionsfor the standard README sections.test_docs_pages_in_syncsodocs/pages.jlmatchesdocs/docs_config.jl. Turn it off withdocs_pages_in_sync = falseinqa_config.jl.test_doctestso docstring examples run.test_formattingso source matches the pinned formatter.test_lintingfor JET static analysis.test_ext_ambiguitiesfor packages with extensions.
Configure the checks in qa_config.jl, not quality.jl.
What QA_CONFIG holds
qa_config.jl defines a QA_CONFIG named tuple with:
the module under test;
the JET and formatter environment paths;
per-check Aqua relaxations;
ExplicitImports ignore lists;
docstring cross-reference ignores;
the README requirements;
the extensions to ambiguity-check.
README wording checks
Three README checks run by default. Turn one off in the readme field of qa_config.jl, with a comment saying why:
readme = (;
path = joinpath(@__DIR__, "..", ".."),
# The Why section is a feature inventory pending a rewrite.
bullets = false,
)The flags are placeholders, prose and bullets, and each defaults to true. A new README fails the placeholders check until you fill in its placeholder text.
test_readme_placeholdersfails on unfilled scaffold placeholder text.test_readme_prosefails on words inBANNED_README_WORDSand on sentences over a length limit.test_readme_bulletsfails on Why-section bullets that open with a bold label and a colon, that run to more than one sentence, or that number outside 3 to 6.
Check details
The placeholder patterns come from the seeded README skeleton, so a new scaffold placeholder is checked without a code change. The prose check reads prose only. It skips code fences, tables, inline code and link URLs. The seeded skeleton passes the bullets and prose checks. A qa_config.jl with no flags gets all three checks. You can also call the checks from your own tests, for example to pass a different banned list.
Eager option validation
A function that takes named options should reject an unknown name at once. The error names each bad key and lists the valid set. Check this with test_option_validation, once per entry point:
test_option_validation(k -> configure(; Dict(k => true)...), VALID_KEYS)It feeds f random names outside the valid set and checks each error names the value and lists every valid entry. It is not in the generic quality testset, so add it to your own @testitems.
Why, and the reference implementation
An ignored option name is a latent bug. The caller thinks they set a value, and the mistake shows up later as a wrong result, if at all. A mistyped sweep axis can send a whole run down the wrong path. The reference is scaffold's licence check, EpiAwarePackageTools.SUPPORTED_LICENSES in the internal _validate_license:
license in SUPPORTED_LICENSES || error(
"unsupported license $(repr(license)); choose one of " *
join(repr.(SUPPORTED_LICENSES), ", "))Show the bad value and the valid set with repr. Where a plausible option is deliberately excluded, say why in the message, for example
Isolated JET and formatter environments
JET and Runic each run in their own environment, test/jet/ and test/formatter/, as a subprocess of the quality testset. The formatter check reports unformatted files under src, test, docs, benchmark and ext without changing them. The JET check fails on any report. For DynamicPPL @model functions, add a package-owned test/jet/jet_config.jl that defines a JET_REPORT_FILTER predicate, such as the ready-made dynamicppl_model_filter.
Why separate environments, and the Runic version
JET and Runic pin JuliaSyntax versions that clash with each other and with the test dependencies. Runic has one fixed style and no config file (see Package standards). The pre-commit hook, test environment and formatter environment all require Runic at or above one floor version. The floor is the release whose style the managed files use. A Runic release that changes layout raises the floor along with the reformat.
Running the tests
Pkg.test() runs the full suite. The scaffolded Taskfile.yml wraps the common modes.
task testruns everything, including quality and AD gradient tests.task test-fastskips the quality checks.task test-qualityruns only the quality checks.task test-jetandtask test-formattingrun those checks alone.task test-parallelrunstest-fastandtest-qualityat the same time.
The managed pre-commit.yaml workflow runs the formatter in CI at the same version as the local hook.
Running only what you need, and running slices at once
Pass any of the test arguments listed above directly.
Pkg.test(test_args=["readme_only"])Each run is a separate process, so you can start several at once.
Running other combinations in parallel
The runner does not run items concurrently within one process. task test-parallel uses Task's deps:, which runs its listed tasks concurrently:
test-parallel:
desc: Run test-fast and test-quality concurrently (faster local iteration)
deps: [test-fast, test-quality]For any other combination, start two julia --project=. -e 'Pkg.test(test_args=[...])' processes in the background and wait on both. Each produces its own report, so there is nothing to merge. For example, a package with a slow README suite might run skip_quality and readme_only side by side.