Skip to content

Commit

Permalink
Create CONTRIBUTING.md
Browse files Browse the repository at this point in the history
  • Loading branch information
popzxc committed Jul 17, 2024
1 parent f27d1fd commit b20f81e
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 43 deletions.
49 changes: 49 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Contributing to `cargo-workspaces`

If you want to contribute to the project, take a look at [open issues](https://github.com/pksunkara/cargo-workspaces/issues)
or create a PR.

Please make sure that new functionality has tests.

## Running tests

The recommended way to run tests for the crate is as follows:

```sh
cargo test --manifest-path cargo-workspaces/Cargo.toml -j1
```

The integration tests manipulate the file system, so running them from multiple threads
may cause race conditions and unexpected failures.

### Adding tests and updating snapshots

`cargo-workspaces` uses [`insta`](https://docs.rs/insta/) for snapshot testing.

When updating tests, you may run tests via:

```
INSTA_UPDATE=always cargo test <args>
```

If you don't want to override any existing snapshots, use:

```
INSTA_UPDATE=unseen cargo test <args>
```

Always make sure that generated snapshots match what you expect the test to produce.
Do not blindly commit changes in snapshots that you do not anticipate.

For more details, check the `insta` documentation.

### Troubleshooting

If you observe unexpected differences in snapshots, you may want to override your compiler to
the same version as used in [CI](.github/workflows/ci.yml), e.g.:

```
cargo override set 1.70
```

The newer versions of `cargo` may produce different output, which would break snapshot tests.
45 changes: 2 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,51 +314,10 @@ overrides the value specified in **Workspace**.
| `independent` | `bool` | No | Yes | `version`, `publish` |
| `no_individual_tags` | `bool` | Yes | No | `version`, `publish` |

## Running tests

The recommended way to run tests for the crate is as follows:

```sh
cargo test --manifest-path cargo-workspaces/Cargo.toml -j1
```

The integration tests manipulate the file system, so running them from multiple threads
may cause race conditions and unexpected failures.

### Adding tests and updating snapshots

`cargo-workspaces` uses [`insta`](https://docs.rs/insta/) for snapshot testing.

When updating tests, you may run tests via:

```
INSTA_UPDATE=always cargo test <args>
```

If you don't want to override any existing snapshots, use:

```
INSTA_UPDATE=unseen cargo test <args>
```

Always make sure that generated snapshots match what you expect the test to produce.
Do not blindly commit changes in snapshots that you do not anticipate.

For more details, check the `insta` documentation.

### Troubleshooting

If you observe unexpected differences in snapshots, you may want to override your compiler to
the same version as used in [CI](.github/workflows/ci.yml), e.g.:

```
cargo override set 1.70
```

The newer versions of `cargo` may produce different output, which would break snapshot tests.

<!-- omit from toc -->
## Contributors
See the [Contributor guide](CONTRIBUTING.md).

Here is a list of [Contributors](http://github.com/pksunkara/cargo-workspaces/contributors)

<!-- omit from toc -->
Expand Down

0 comments on commit b20f81e

Please sign in to comment.