This project uses Vitest for unit testing, following the same patterns as mystmd.
Running Tests¶
Run all tests across packages:
# From repository root
bun run testRun tests in a specific package:
cd packages/<package-name>
bun run testTest File Locations¶
Tests are located in one of two places, depending on the package:
Co-located with source (used by
@myst-theme/common):Place
.spec.tsfiles alongside source files insrc/Example:
packages/common/src/utils.spec.ts
Separate test directory (used by
@myst-theme/jupyter):Create a
test/directory in the package rootExample:
packages/jupyter/test/thebeOptions.spec.ts
Add a test¶
The root bun run test uses turbo to run tests.
It will run tests in one of the repository packages if you define a test script in its package.json.
For example, see the myst-to-react configuration:
{
"name": "myst-to-react",
"version": "1.0.1",
...
"scripts": {
"test": "vitest run",
...Accessibility audit¶
On every push to main, the a11y.yml workflow builds the documentation against the local theme and runs an axe-core accessibility audit via berkeley-cdss/myst-a11y.
If violations are found, the results are reported in a GitHub issue labelled a11y-audit.
The issue body is generated by .github/scripts/a11y-report.mjs, which summarises the audit by rule and by page and lists example offending elements.
To see the current state of accessibility issues, look for the open a11y-audit issue.