About Harper's Test Suite

Harper's goal is to deliver top-tier grammar checking fast, without compromising privacy. How do we maintain quality while also iterating quickly on our core engine?

As you know, Harper's core engine is written in Rust. As a corollary to that, we use Cargo to pull dependencies, build, and test the system. While we do take advantage of snapshot and integration tests, we tend to focus our efforts on unit tests.

Performance

In the interest of maintaining fast iteration cycles, we run our tests with opt-level = 1. These optimizations are known to cause issues with debuggers. If you plan to use one, you may want to comment them out.

[workspace]
members = ["harper-cli", "harper-core", "harper-ls", "harper-comments", "harper-wasm", "harper-tree-sitter", "harper-html", "harper-literate-haskell", "harper-typst", "harper-stats", "harper-pos-utils", "harper-brill", "harper-ink", "harper-python", "harper-jjdescription", "harper-thesaurus", "harper-asciidoc", "fuzz", "harper-tex", "harper-desktop/src-tauri"]
resolver = "2"

[profile.test]
opt-level = 1

[profile.test.package."*"]
opt-level = 3

[profile.release]
opt-level = 3
panic = "abort"
lto = "fat"
# Stripping binaries triggers a bug in `wasm-opt`.
# Disable it for now.
# strip = true

# Release profile with debug info.
# Useful for debugging and profiling.
[profile.release-debug]
inherits = "release"
debug = 2
toml

Filtering Tests

Use cargo test -- <REGEX> to run only tests whose names match a pattern. When iterating on core rules, it is usually fastest to run this from harper-core:

cd harper-core
cargo test -- <REGEX>
bash

This repeatedly runs the rule's focused tests while skipping tests from other workspace crates.

Other Reading

Last update at: Invalid Date