mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-03 13:55:39 +02:00
Integrate the new reporter specs into Catch2
This means that the CLI interface now uses the new key-value oriented reporter spec, the common reporter base creates the colour implementation based on the reporter-specific configuration, and it also stores the custom configuration options for each reporter instance. Closes #339 as it allows per-reporter forcing of ansi colour codes.
This commit is contained in:
@@ -43,9 +43,14 @@ them write into different destinations. The two main uses of this are
|
||||
|
||||
Specifying multiple reporter looks like this:
|
||||
```
|
||||
--reporter console::- --reporter JUnit::result-junit.xml
|
||||
--reporter JUnit::out=result-junit.xml --reporter console::out=-::colour-mode=ansi
|
||||
```
|
||||
|
||||
This tells Catch2 to use two reporters, `JUnit` reporter that writes
|
||||
its machine-readable XML output to file `result-junit.xml`, and the
|
||||
`console` reporter that writes its user-friendly output to stdout and
|
||||
uses ANSI colour codes for colouring the output.
|
||||
|
||||
Using multiple reporters (or one reporter and one-or-more [event
|
||||
listeners](event-listener.md#top)) can have surprisingly complex semantics
|
||||
when using customization points provided to reporters by Catch2, namely
|
||||
@@ -162,6 +167,26 @@ Currently there are two customization options:
|
||||
format includes passing assertions even without the `-s` flag.
|
||||
|
||||
|
||||
### Per-reporter configuration
|
||||
|
||||
> Per-reporter configuration was introduced in Catch2 X.Y.Z
|
||||
|
||||
Catch2 supports some configuration to happen per reporter. The configuration
|
||||
options fall into one of two categories:
|
||||
|
||||
* Catch2-recognized options
|
||||
* Reporter-specific options
|
||||
|
||||
The former is a small set of universal options that Catch2 handles for
|
||||
the reporters, e.g. output file or console colour mode. The latter are
|
||||
options that the reporters have to handle themselves, but the keys and
|
||||
values can be arbitrary strings, as long as they don't contain `::`. This
|
||||
allows writing reporters that can be significantly customized at runtime.
|
||||
|
||||
Reporter-specific options always have to be prefixed with "X" (large
|
||||
letter X).
|
||||
|
||||
|
||||
### Other expected functionality of a reporter
|
||||
|
||||
When writing a custom reporter, there are few more things that you should
|
||||
|
Reference in New Issue
Block a user