#cargo test -- --nocapture not giving desired output

21 messages · Page 1 of 1 (latest)

fringe kelp
#

Hi! Noob here testing out soroban. I am currently in Getting started - 3. Storing data, working on the incrementor. When i 'cargo test -- --nocapture' I do not get the output shown in docs, but rather:

running 1 test
Writing test snapshot file for test "test::increment" to "test_snapshots/test/increment.1.json".
test test::increment ... ok

What am I doing wrong?

maiden vale
#

Hi, I pinged you in general. Probably won't be helpful but check it out.

fringe kelp
#

Thanks for the help! However, the AI didn't quite get it 😁 the problem is I do have log! command but it still wont show even if I use --nocapture

empty pecan
#

What version of soroban-sdk do you have in cargo.toml?

fringe kelp
#

Everything should be as is in the soroban documentation "getting started".

#

I was also checking the documentation about logging and I have the

[profile.release-with-logs]
inherits = "release"
debug-assertions = true

section in the projects cargo file

empty pecan
#

Ah I see

#

In the test.rs from that example, I don't see anything that I think would print

#

Let me try to run it.

#

Regardless, I'd recommend to use the latest version of soroban-sdk, as 20.0.0 is not compatible with testnet I think (yes, the docs need to be updated)

fringe kelp
#

Isn't the 'log!(&env, "count: {}", count);' from lib.rs what's supposed to print when the test runs the three loops of function 'increment'? Run it and see, and thank you for helping! I changed sdk to latest version! 🙂

empty pecan
#

I use std::println!("") macros in my tests, those do get printed to the terminal. I never mastered log!

#

I'll see if I can find something

fringe kelp
empty pecan
#

It seems something's changed about how logs work I think

#

Adding the below to test.rs does output log results:

extern crate std;
use std::println;
use soroban_sdk::{testutils::Logs, Env};

let logs = env.logs().all();
std::println!("{}", logs.join("\n"));

But that does not seem the simplest way to achieve it