Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update test, coverage, and lint commands in Justfile to improve clarity and consistency #23

Merged
merged 1 commit into from
Mar 8, 2024
Merged
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
12 changes: 8 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ default: test lint
clean:
cargo clean

test target="workspace": && (_doctest target)
# Test the given crate or the entire workspace if target is omitted
test target="workspace": && (doctest target)
echo Running tests for target '"{{ target }}"'
cargo nextest run {{ if target == "workspace" { "--workspace" } else { "--package " + target } }}

_doctest target: (
[private]
doctest target: (
exec if target == "workspace" {
"cargo test --doc --workspace --exclude googleapis"
} else if target == "googleapis" {
Expand All @@ -25,13 +27,15 @@ _doctest target: (
exec +cmd:
{{ cmd }}

# Test the given crate with coverage info or the entire workspace if target is omitted
cov target="workspace":
cargo tarpaulin --out lcov --out html {{ if target == "workspace" { "--workspace" } else { "--packages " + target } }}

# Lint the given crate or the entire workspace if target is omitted
lint target="workspace":
echo Running lint for target '"{{ target }}"'
cargo clippy {{ if target == "workspace" { "--workspace" } else { "--package " + target } }}

# Watch code and execute just command on change
watch +cmd="lint":
# Watch code and execute just command on change, e.g. `just watch test googleapis`
watch *cmd:
cargo watch --ignore '*.{info,html,profraw}' --clear --shell 'just {{ cmd }}'
Loading