File tree Expand file tree Collapse file tree 2 files changed +33
-7
lines changed Expand file tree Collapse file tree 2 files changed +33
-7
lines changed Original file line number Diff line number Diff line change @@ -63,25 +63,43 @@ git pull upstream main --ff-only
6363
6464### Code linting, formatting, and tests
6565
66- You can run linting on your code at any time with:
66+ #### Run linting
6767
6868``` sh
6969cargo clippy --all-targets
7070```
7171
72- To format the code run:
72+ #### Run the code formater
7373
7474``` sh
75- cargo fmt
75+ cargo fmt --all
76+ ```
77+
78+ #### Testing the code
79+
80+ [ insta] ( https://insta.rs" ) is used for snapshot testing. It is recommended
81+ to install [ cargo-insta] ( https://github.com/mitsuhiko/insta/tree/master/cargo-insta ) to run the
82+ tests
83+
84+ ``` sh
85+ cargo install cargo-insta --locked
7686```
7787
7888To run the tests:
7989
8090``` sh
81- cargo test
91+ cargo insta test
8292```
8393
84- To ensure the code compiles run:
94+ If the code change is expected to update a snapshot, for example when updating a default
95+ dependency, run the tests with the verify flat and check that the new snapshots are correct, then
96+ accept them.
97+
98+ ``` sh
99+ cargo insta test --verify
100+ ```
101+
102+ #### Ensure the code compiles
85103
86104``` sh
87105cargo check --all-targets
@@ -99,13 +117,18 @@ To run linting:
99117just lint
100118```
101119
102- Using just to run the tests will start Meilisearch in a Docker container, run the tests, then stop
103- the container.
120+ To run tests:
104121
105122``` sh
106123just test
107124```
108125
126+ To run tests and review snapshots:
127+
128+ ``` sh
129+ just test-review
130+ ```
131+
109132To see a full list of ` just ` commands run ` just --list `
110133
111134## Committing your code
Original file line number Diff line number Diff line change 1919 cargo fmt --all
2020
2121test :
22+ cargo insta test
23+
24+ test-review :
2225 cargo insta test --review
You can’t perform that action at this time.
0 commit comments