Skip to content

Is it possible to output both Json and Junit #287

Answered by ilslv
ecaponi3 asked this question in Q&A
Discussion options

You must be logged in to vote

@ecaponi3 yes, you can use WriterExt::tee() to chain any number of Writers:

.with_writer(
    writer::Basic::stdout()
        .summarized()
        .tee(writer::Json::new(json.reopen().unwrap()))
        .tee(writer::JUnit::new(junit.reopen().unwrap(), 1)),
)

You can also speed up computations a bit by using non-normalized Writers in WriterExt::tee() and lift a single normalization:

.with_writer(
    writer::Basic::raw(io::stdout(), Coloring::Auto, 0)
        .summarized()
        .tee(writer::Json::for_tee(json))
        .tee(writer::JUnit::for_tee(junit, 1))
        .normalized(),
)

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@tyranron
Comment options

@ecaponi3
Comment options

Answer selected by tyranron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested k::api Related to API (application interface)
3 participants
Converted from issue

This discussion was converted from issue #285 on May 26, 2023 06:36.