I'm just getting started and am looking to speed up the test suite, so it's really fun to work with. With the least code possible, changes are taking a full second or more to report back. Is it possible to speed this up?
Coming from scripted languages like Node.js, I'm used to changes reporting back in <10ms.
Any chance there's an option I'm missing on cargo or a package, or maybe even a RustScript of sorts that can be used for just cruising through the green-red-refactor cycle?
A really quick example
So far, I've got this code under test:
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
Then, I'll start the cargo watch (Not bad at ~20ms):
$ cargo watch -x test -x check
[Running 'cargo test && cargo check']
Finished test [unoptimized + debuginfo] target(s) in 0.01s
Running target\debug\deps\adder-8e5e898cf523b816.exe
running 1 test
test tests::it_works ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
Doc-tests adder
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
Finished dev [unoptimized + debuginfo] target(s) in 0.02s
[Finished running. Exit status: 0]
Then, I make a change and it takes about 1 full second:
[Running 'cargo test && cargo check']
Compiling adder v0.1.0 (C:\dev\rusttest\adder)
Finished test [unoptimized + debuginfo] target(s) in 0.84s
Running target\debug\deps\adder-8e5e898cf523b816.exe
running 1 test
test tests::it_works ... FAILED
failures:
---- tests::it_works stdout ----
thread 'tests::it_works' panicked at 'assertion failed: `(left == right)`
left: `3`,
right: `4`', src\lib.rs:5:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
failures:
tests::it_works
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
error: test failed, to rerun pass '--lib'
[Finished running. Exit status: 0]