Confusing `cargo contract test` output
Created by: HCastano
I've been running some (failing) tests with cargo contract test
and I keep getting the same confusing output:
❯ cargo contract test --manifest-path ./examples/erc20/Cargo.toml
[1/1] Running tests
Finished test [unoptimized + debuginfo] target(s) in 0.18s
Running unittests (target/debug/deps/erc20-1af083c7da0bf9ac)
error: test failed, to rerun pass '--lib'
ERROR: `"/Users/hcastano/.rustup/toolchains/nightly-x86_64-apple-darwin/bin/cargo" "test" ""` failed with exit code: Some(101)
The error doesn't tell me the name of the test(s) which failed or the line at which they failed.
Note that cargo test
does produce the correct results:
❮ cargo test --manifest-path ./examples/erc20/Cargo.toml
Finished test [unoptimized + debuginfo] target(s) in 0.06s
Running unittests (examples/erc20/target/debug/deps/erc20-1af083c7da0bf9ac)
running 7 tests
test erc20::tests::new_works ... ok
test erc20::tests::balance_of_works ... ok
test erc20::tests::invalid_transfer_should_fail ... ok
test erc20::tests::allowance_must_not_change_on_failed_transfer ... ok
test erc20::tests::transfer_works ... ok
test erc20::tests::total_supply_works ... FAILED
test erc20::tests::transfer_from_works ... ok
failures:
---- erc20::tests::total_supply_works stdout ----
thread 'erc20::tests::total_supply_works' panicked at 'assertion failed: `(left == right)`
left: `100`,
right: `200`', lib.rs:312:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
erc20::tests::total_supply_works
test result: FAILED. 6 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
This is true for the current release (v0.17.0
) and well as the current master (924ca5d
). This is an issue on both macOS and Linux.
Ideally cargo contract test
produces the same (or better) output as cargo test
.