You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/developer.md
+48-4Lines changed: 48 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -263,7 +263,8 @@ Below you will see several `npm run x` commands.
263
263
These are simply aliases for other commands, defined in the [`package.json` file](https://github.com/jupyter-book/mystmd/blob/main/package.json) under "scripts".
264
264
```
265
265
266
-
## Developer workflow: myst CLI
266
+
(developer:mystmd)=
267
+
## Local development: `mystmd`
267
268
268
269
The `mystmd` libraries and command line tools are written in [TypeScript](https://www.typescriptlang.org/), and require [NodeJS and npm](https://nodejs.org) for local development.
269
270
@@ -306,7 +307,7 @@ The build process uses unix commands that might not work properly on Windows.
306
307
When building on Windows, use either WSL or a unix-like shell (such as Git Bash or MSYS2), and make sure that npm is set to use these by default (`npm config set script-shell path/to/shell.exe`).
307
308
```
308
309
309
-
## Developer workflow: myst-theme
310
+
## Local development: myst-theme
310
311
311
312
The [`myst-theme` README](https://github.com/jupyter-book/myst-theme/) provides a more detailed overview of the components of that package.
312
313
@@ -456,15 +457,58 @@ The process for releasing `myst-theme` infrastructure is similar to the release
456
457
457
458
We use [Turbo](https://turborepo.com/) to manage our testing and build system.
458
459
460
+
(developer:testing)=
459
461
### Testing
460
462
461
-
Tests help ensure that code operates as intended, and that changes do not break existing code. You can run the test suite using:
463
+
We use [vitest](https://vitest.dev/guide/) for all tests in `mystmd`.
464
+
465
+
#### How to run the test suite
466
+
467
+
First [install `mystmd` locally](#developer:mystmd).
468
+
469
+
Then, run the test suite using:
462
470
463
471
```shell
464
472
npm run test
465
473
```
466
474
467
-
If you are working in a particular package, change your working directory to that specific package, and run the tests there. To run in "watch mode" (runs each time a change is saved), use `npm run test:watch`.
475
+
If you are working in a particular package, change your working directory to that specific package, and run the tests there.
476
+
477
+
```shell
478
+
cd packages/myst-cli
479
+
npm run test
480
+
```
481
+
482
+
To run in "watch mode" (runs each time a change is saved), use:
483
+
484
+
```shell
485
+
npm run test:watch
486
+
```
487
+
488
+
To run a single test by matching its title, first change the working directory to the package where the test exists. For example:
489
+
490
+
```shell
491
+
cd packages/mystmd
492
+
```
493
+
494
+
Then run the `npm test` command like so:
495
+
496
+
```shell
497
+
npm run test -- -t "Basic tex build"
498
+
```
499
+
500
+
For integration test titles, see `packages/mystmd/tests/exports.yml`.
501
+
502
+
#### Types of tests
503
+
504
+
There are two types of tests in the `mystmd` repository:
505
+
506
+
**Unit Tests** - are attached to each sub-package in the `packages/` directory. These use [`vitest`](https://vitest.dev/) for basic functionality within each package. They have files like [`config.spec.ts`](https://github.com/jupyter-book/mystmd/blob/main/packages/myst-cli/src/config.spec.ts).
507
+
508
+
**Integration Tests** - Test the entire `mystmd` build workflow. Here's how it works:
509
+
510
+
-`packages/mystmd/tests/endToEnd.spec.ts` runs a build from end to end, similar to the `vitest` tests above.
511
+
-`packages/mystmd/tests/exports.yml` contains several integration tests - each one points to a build configuration (a folder in `packages/mystmd/tests/`) and compares expected to generated outputs.
0 commit comments