Skip to content
This repository was archived by the owner on Jan 26, 2025. It is now read-only.

Commit d7d0c8f

Browse files
swaitstingerrr
authored andcommitted
docs: describe "typst-test watch" workaround with watchexec
second commit, without LSP formatting breadcrumbs
1 parent bfc07ef commit d7d0c8f

File tree

4 files changed

+34
-1
lines changed

4 files changed

+34
-1
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ Out of the box `typst-test` supports the following features:
1010
- provide extra scripting functionality
1111
- running custom scripts for test automation
1212

13+
`typst-test` does not currently include a "watch" command to automatically run anytime a file changes.
14+
However, the book [includes a suggested workaround for this](https://tingerrr.github.io/typst-test/guides/watching.html).
15+
1316
## Stability
14-
`typst-test` currently makes no stability guarantees, it is considered pre-0.1.0, see the [Milestones] for it's progress towards a first release.
17+
`typst-test` currently makes no stability guarantees, it is considered pre-0.1.0, see the [Milestones] for its progress towards a first release.
1518
However, all PRs and pushes to main are tested in CI.
1619
A reasonably "stable" version of `typst-test` is available at the `ci-semi-stable` tag.
1720
This version is already used in the CI of various Typst packages, such as cetz, codly, valkyrie, hydra or subpar.

docs/book/src/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ This book contains a few sections aimed at answering the most common questions r
2020
After the quick start, a few guides delve deeper into some advanced topics.
2121
- [Writing Tests](./guides/tests.md) inspects adding, removing, updating and editing tests more closely.
2222
- [Using Test Sets](./guides/test-sets.md) delves into the test set language and how it can be used to isolate tests and speed up your TDD workflow.
23+
- [Watching for Changes](./guides/watching.md) automatically run tests while developing your package.
2324
- [Automation](./guides/automation.md) explains the ins and outs of hooks and how they can be used for testing typst preprocessors or formatters.
2425
- [Setting Up CI](./guides/ci.md) shows how to set up `typst-test` to continuously test all changes to your package.
2526

docs/book/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# Guides
99
- [Writing Tests]()
1010
- [Using Test Sets](./guides/test-sets.md)
11+
- [Watching for Changes](./guides/watching.md)
1112
- [Automation]()
1213
- [Setting Up CI](./guides/ci.md)
1314

docs/book/src/guides/watching.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Watching for Changes
2+
3+
`typst-test` does not currently support a "watch" command, which is common in this sort of tooling.
4+
This is due to some of the complexity in how it uses the core Typst libraries.
5+
6+
However, you may workaround this by using [`watchexec`](https://watchexec.github.io/).
7+
To begin, install it following the installation instructions in its [README](https://github.com/watchexec/watchexec).
8+
9+
Then, run a command like this in your package root directory, which is the same directory with your `typst.toml` and `README.md` file:
10+
11+
```bash
12+
watchexec \
13+
--watch . \
14+
--clear \
15+
--ignore 'tests/**/diff/**' \
16+
--ignore 'tests/**/out/**' \
17+
"typst-test r"
18+
```
19+
20+
This will run `typst-test r` whenever any file changes other than those in your tests' `{diff,out}` directories.
21+
22+
You may create an alias in your shell to make it more convenient:
23+
24+
```bash
25+
alias ttw="watchexec --watch . --clear --ignore 'tests/**/diff/**' --ignore 'tests/**/out/**' 'typst-test r'"
26+
```
27+
28+
Note, if your tests change any files in your package source tree, you may need to include them as additional `--ignore <glob>` patterns to the command.

0 commit comments

Comments
 (0)