summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Lo <stan.lo@shopify.com>2025-08-27 19:24:05 +0100
committerMax Bernstein <tekknolagi@gmail.com>2025-08-28 06:20:30 -0700
commit89e18473a9ef3d06a864855e19536cc2f3188f17 (patch)
tree96bc94a43ead4d17e0962a60e36a470996ed6512
parent6b7ed4cad208ab7528070a66b1c97906606fa499 (diff)
ZJIT: Update doc about snapshot update
-rw-r--r--doc/zjit.md26
1 files changed, 20 insertions, 6 deletions
diff --git a/doc/zjit.md b/doc/zjit.md
index 90f890bfa0..ef15c6dac4 100644
--- a/doc/zjit.md
+++ b/doc/zjit.md
@@ -26,7 +26,9 @@ in a way that can be easily shared with other team members.
## Testing
-Make sure you have a `--enable-zjit=dev` build, and run `brew install cargo-nextest` first.
+Make sure you have a `--enable-zjit=dev` build, and install the following tools:
+- `brew install cargo-nextest` - Required for running tests
+- `cargo install cargo-insta` - Required for updating snapshots
### make zjit-check
@@ -38,7 +40,7 @@ make zjit-check
### make zjit-test
-This command runs Rust unit tests.
+This command runs Rust unit tests using `insta` for snapshot testing.
```
make zjit-test
@@ -50,12 +52,24 @@ You can also run a single test case by specifying the function name:
make zjit-test ZJIT_TESTS=test_putobject
```
-If you expect that your changes cause tests to fail and they do, you can have
-`expect-test` fix the expected value for you by putting `UPDATE_EXPECT=1`
-before your test command, like so:
+#### Snapshot Testing
+
+ZJIT uses [insta](https://insta.rs/) for snapshot testing. When tests fail due to snapshot mismatches, pending snapshots are created. The test command will notify you if there are pending snapshots:
+
+```
+Pending snapshots found. Accept with: make zjit-test-update
+```
+
+To update/accept all the snapshot changes:
+
+```
+make zjit-test-update
+```
+
+You can also review snapshot changes interactively one by one:
```
-UPDATE_EXPECT=1 make zjit-test ZJIT_TESTS=test_putobject
+cd zjit && cargo insta review
```
Test changes will be reviewed alongside code changes.