approvals / ApprovalTests.cpp

Native ApprovalTests for C++ on Linux, Mac and Windows
https://approvaltestscpp.readthedocs.io/en/latest/
Apache License 2.0
310 stars 50 forks source link

Catch2 v3 integration #210

Closed LesleyLai closed 4 months ago

LesleyLai commented 11 months ago

The new version of Catch2 seems to break a bunch of things for ApprovalTests

ricardomatias commented 5 months ago

Any workaround?

claremacrae commented 5 months ago

Just to note that we are actively working on this currently, with the help of @Laguna1989:

See:

Our next step is to update the documentation, and then we will release it.

Any workaround?

@ricardomatias, if you wish to read through the changes in the above PRs, you are welcome to try.

Otherwise, it will be released soon, likely within the next few weeks.

ricardomatias commented 5 months ago

Thanks @claremacrae. I'm unsure if it's related, but I get a ApprovalMissingException (using master branch). I'm linking in cmake via target_link_libraries(${TEST_BASENAME} ApprovalTests::ApprovalTests Catch2::Catch2WithMain) and each test executable includes also the following file with:

#define APPROVALS_CATCH2_V3
#include "ApprovalTests.hpp"
#include <catch2/catch_all.hpp>

auto defaultReporterDisposer = ApprovalTests::Approvals::useAsDefaultReporter(
    std::make_shared<ApprovalTests::AutoApproveIfMissingReporter>());
auto directoryDisposer = ApprovalTests::Approvals::useApprovalsSubdirectory("snapshots");

The .received.txt file is created but nothing prompts it to be approved even with AutoApproveIfMissingReporter. It's also not clear how ApprovalTests tries to find the diffing tools in the path, but I have visual studio code in the path.

claremacrae commented 5 months ago

@ricardomatias Please use the last-released version of Approval Tests until we have fully tested, documented and released Catch2 V3 support. Thanks.

claremacrae commented 4 months ago

This is done and will be released soon