Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Testing

This project uses Vitest for unit testing, following the same patterns as mystmd.

Running Tests

Run all tests across packages:

# From repository root
npm run test

Run tests in a specific package:

cd packages/<package-name>
npm run test

Test File Locations

Tests are located in one of two places, depending on the package:

  1. Co-located with source (used by @myst-theme/common):

    • Place .spec.ts files alongside source files in src/

    • Example: packages/common/src/utils.spec.ts

  2. Separate test directory (used by @myst-theme/jupyter):

    • Create a test/ directory in the package root

    • Example: packages/jupyter/test/thebeOptions.spec.ts

Add a test

The root npm 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:

package.json
{
  "name": "myst-to-react",
  "version": "1.0.1",
  ...
  "scripts": {
    "test": "vitest run",
    ...