Skip to content

Commit 269a305

Browse files
docs(testing): add pre-submission quality gates section
Documents the exact CI commands to run locally before submitting changes. Covers the RUSTFLAGS="-D warnings" requirement and common pitfalls around test module allow attributes.
1 parent 53d5410 commit 269a305

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

docs/src/development/testing.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,47 @@
22

33
This page covers testing conventions and practices for cascette-rs.
44

5+
## Pre-Submission Quality Gates
6+
7+
Run these commands before every commit or PR. They match the CI workflow
8+
exactly. CI sets `RUSTFLAGS="-D warnings"` globally, so any warning becomes a
9+
hard error. **Running without that flag hides issues that will fail CI.**
10+
11+
```bash
12+
# Format check
13+
cargo fmt --all -- --check
14+
15+
# Compilation — all targets, warnings as errors
16+
RUSTFLAGS="-D warnings" cargo check --workspace --all-targets
17+
18+
# Clippy — all targets, warnings as errors
19+
RUSTFLAGS="-D warnings" cargo clippy --workspace --all-targets
20+
21+
# Tests — default features, warnings as errors
22+
RUSTFLAGS="-D warnings" cargo nextest run --profile ci --workspace
23+
24+
# Tests — no default features
25+
RUSTFLAGS="-D warnings" cargo nextest run --profile ci --no-default-features --workspace
26+
27+
# Documentation — warnings as errors
28+
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps
29+
30+
# WASM compilation check
31+
RUSTFLAGS="-D warnings" cargo check --target wasm32-unknown-unknown -p cascette-crypto -p cascette-formats
32+
```
33+
34+
All seven checks must pass before submitting changes. A PR that fails any
35+
of these will not be merged.
36+
37+
### Common Pitfalls
38+
39+
Running `cargo clippy` without `RUSTFLAGS="-D warnings"` produces warnings
40+
that silently pass locally but fail CI. Always use the exact commands above.
41+
42+
Tests that use `.unwrap()` or `.expect()` in `#[cfg(test)]` modules need
43+
`#[allow(clippy::unwrap_used, clippy::expect_used)]` on the module — the
44+
workspace lints flag these even in tests.
45+
546
## Test Organization
647

748
### Module Structure

0 commit comments

Comments
 (0)