Skip to content

Commit

Permalink
Cargo.toml: add crates to workspace
Browse files Browse the repository at this point in the history
This allows IDE integration to work when the root of the repository is
opened. Prior to this change, a developer would have to open cargo-insta
to get code completion for that crate.

This also causes clippy to run on all crates, so this commit fixes a few
lints.

The integration-tests crate's test is changed to a proper test function
so that it can rely on always being run from the root of the
integration-tests crate. Care is taken to remove the tests directory
after running to avoid pollution in which `cargo test` attempts to run
those tests.
  • Loading branch information
tamird committed Oct 9, 2023
1 parent dc08881 commit 8bb9ea8
Show file tree
Hide file tree
Showing 16 changed files with 311 additions and 74 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/tests.yml
Expand Up @@ -24,6 +24,8 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.61.0
- name: Use Cargo.lock.msrv
run: cp Cargo.lock.msrv Cargo.lock
- name: Test
run: make cargotest

Expand Down
222 changes: 221 additions & 1 deletion cargo-insta/Cargo.lock → Cargo.lock.msrv

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Expand Up @@ -18,6 +18,9 @@ exclude = [
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[workspace]
members = ["cargo-insta", "cargo-insta/integration-tests"]

[features]
default = ["colors"]

Expand Down
6 changes: 3 additions & 3 deletions Makefile
Expand Up @@ -12,7 +12,7 @@ cargo-insta-tests:
@echo "CARGO-INSTA INTEGRATION TESTS"
# Turn off CI flag so that cargo insta test behaves as we expect
# under normal operation
@cd cargo-insta/integration-tests; CI=0 cargo run
@CI=0 cargo test -p integration-tests

cargotest:
@echo "CARGO TESTS"
Expand All @@ -21,7 +21,7 @@ cargotest:
@cargo test --all-features
@cargo test --no-default-features
@cargo test --features redactions -- --test-threads 1
@cd cargo-insta; cargo test
@cargo test -p cargo-insta

check-minver:
@echo "MINVER CHECK"
Expand All @@ -40,6 +40,6 @@ format-check:

lint:
@rustup component add clippy 2> /dev/null
@cargo clippy
@cargo clippy --all-targets --workspace -- --deny warnings

.PHONY: all doc test cargotest format format-check lint update-readme
1 change: 0 additions & 1 deletion cargo-insta/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions cargo-insta/integration-tests/.gitignore

This file was deleted.

0 comments on commit 8bb9ea8

Please sign in to comment.