bacon icon indicating copy to clipboard operation
bacon copied to clipboard

Synergy with cargo nextest

Open jacg opened this issue 1 year ago • 4 comments

I find both bacon and cargo nextest to be very useful, and I would like to use them together.

I can persuade bacon to run tests via cargo nextest by specifying this in bacon.toml:


[jobs.test]
command = [
    "cargo", "nextest", "run", "--color", "always",
]
need_stdout = true

When the tests pass I get to see nextest's highly-informative output (in colour, even though it doesn't show up here):


    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.01s
    Starting 1 test across 1 binary (run ID: f68cbdcf-7b7a-4af8-a5f6-01a0005a7d89, nextest profile: default)
        PASS [   0.003s] rust tests::it_works
------------
     Summary [   0.003s] 1 test run: 1 passed, 0 skipped

but when the tests fail, I get the very unhelpful and disapponting

 1  failed: tests::it_is_broken
 no output

Can bacon be made to work with cargo nextest?

jacg avatar Jun 15 '24 10:06 jacg

It seems that the nextest output is shown, but then immediately overwritten with the less interesting output.

This also happens when the tests pass, if the compiler generates warnings: the warnings completely overwrite the nextest output.

jacg avatar Jun 15 '24 11:06 jacg

I'm also very interested in this and was just about to publish the same issue.

nicolasauler avatar Aug 07 '24 02:08 nicolasauler

Note that I see the same behavior with cargo test, so I don't think it's specific to nextest

bruceg avatar Aug 12 '24 15:08 bruceg

I made a few tests, it looks like there's no deep problem: I just must find enough time to define the necessary patterns to analyze the output of nextest.

Canop avatar Aug 12 '24 16:08 Canop

I'd need testers for https://github.com/Canop/bacon/pull/212

Canop avatar Sep 30 '24 19:09 Canop

I'd need testers for #212

I'd be happy to do that How do we test it? I mean, how do we run a branch?

nicolasauler avatar Oct 01 '24 01:10 nicolasauler

@nicolasauler Assuming you want to install with cargo install, then it should be

cargo install --git https://github.com/Canop/bacon --branch nextest

In case you have problems installing, come to the chat at https://miaou.dystroy.org/3768

Canop avatar Oct 01 '24 05:10 Canop

I just tried bacon with the branch (nextest#fb0caf8b) and this configuration:

[jobs.test]
command = [
    "cargo", "nextest", "run", "--color", "always"
]
need_stdout = true

It runs the tests but once complete immediately overwrites the results with the warnings:

image

MLNW avatar Oct 01 '24 10:10 MLNW

Please everybody, have a look at the PR. You need to add this line to the job config:

analyzer = "nextest"

Canop avatar Oct 01 '24 10:10 Canop

I tried it again with the command you put into the PR description but similar result:

image

I couldn't find a way to switch to the test output.

MLNW avatar Oct 01 '24 10:10 MLNW

I couldn't find a way to switch to the test output.

I think this is the intended result: The first line tells you the tests passed successfully. The most relevant information in that case is not the list of tests that passed but warnings that where found while the tests ran.

DragonDev1906 avatar Oct 01 '24 12:10 DragonDev1906

My results:

  1. When attempting lots of failures image

  2. Single failure image

  3. All successes image

That's perfect, in my opinion Thanks a lot @Canop

nicolasauler avatar Oct 01 '24 14:10 nicolasauler