Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 30 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,43 @@ git pull upstream main --ff-only

### Code linting, formatting, and tests

You can run linting on your code at any time with:
#### Run linting

```sh
cargo clippy --all-targets
```

To format the code run:
#### Run the code formater

```sh
cargo fmt
cargo fmt --all
```

#### Testing the code

[insta](https://insta.rs") is used for snapshot testing. It is recommended
to install [cargo-insta](https://github.com/mitsuhiko/insta/tree/master/cargo-insta) to run the
tests

```sh
cargo install cargo-insta --locked
```

To run the tests:

```sh
cargo test
cargo insta test
```

To ensure the code compiles run:
If the code change is expected to update a snapshot, for example when updating a default
dependency, run the tests with the verify flat and check that the new snapshots are correct, then
accept them.

```sh
cargo insta test --verify
```

#### Ensure the code compiles

```sh
cargo check --all-targets
Expand All @@ -99,13 +117,18 @@ To run linting:
just lint
```

Using just to run the tests will start Meilisearch in a Docker container, run the tests, then stop
the container.
To run tests:

```sh
just test
```

To run tests and review snapshots:

```sh
just test-review
```

To see a full list of `just` commands run `just --list`

## Committing your code
Expand Down
3 changes: 3 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@ fmt:
cargo fmt --all

test:
cargo insta test

test-review:
cargo insta test --review