Canop / bacon

background rust code check
https://dystroy.org/bacon
GNU Affero General Public License v3.0
1.78k stars 62 forks source link

Show color in doc test results #193

Open joshka opened 4 months ago

joshka commented 4 months ago

Bacon doesn't appear to colorize test failures in doc tests:

Given the following Error code (intentionally created):

    /// # Examples
    ///
    /// ```
    /// # use ratatui::{prelude::*, buffer::Cell, layout::Position};
    /// let buf = Buffer::empty(Rect::new(0, 0, 10, 10));
    /// let cell = buf[(0, 0)];
    /// let cell = &buf[Position::new(0, 0)];
    /// ```

Cargo test --doc buffer/buffer output:

image

Bacon config:

[jobs.test]
command = [
    "cargo", "test",
    "--all-features",
    "--color", "always",
    "--", "--color", "always", # see https://github.com/Canop/bacon/issues/124
]
need_stdout = true

Bacon output:

image
Canop commented 4 months ago

It looks like cargo test doesn't respect the --color always argument. This might be a regression in cargo test (but it's also possible this was always the case, cargo test is a weird complicated construct).