JSONReporter considers verbosity when listing tests

* Quiet verbosity provides just the test names
* Normal verbosity adds tags
* High verbosity add the source location of the tests

Listing tests with the quiet verbosity results in about 1/4 of the
previous output, which leads to measurably faster execution of
`catch_discover_tests` when it does not need tags for labels.
(If it does need tags, the output is about 1/2 of previous).
This commit is contained in:
Martin Hořeňovský committed 2026-08-08 00:05:18 +02:00
1 parent 0b4d7a5a16
commit 4cde128517
14 files changed
+77 -93

No files matched your search

+4 -2
View File
@@ -349,13 +349,15 @@ namespace Catch {
if (!info.className.empty()) {
desc_writer.write( "class-name"_sr ).write( info.className );
}
{
if ( m_verbosity >= Verbosity::Normal ) {
auto tag_writer = desc_writer.write( "tags"_sr ).writeArray();
for ( auto const& tag : info.tags ) {
tag_writer.write( tag.original );
}
}
writeSourceInfo( desc_writer, info.lineInfo );
if ( m_verbosity >= Verbosity::High) {
writeSourceInfo( desc_writer, info.lineInfo );
}
}
}
void JsonReporter::listTags( std::vector<TagInfo> const& tags ) {
@@ -85,9 +85,6 @@ namespace Catch {
std::stack<Writer> m_writers{};
bool m_startedListing = false;
// std::size_t m_sectionDepth = 0;
// std::size_t m_sectionStarted = 0;
};
} // namespace Catch