approvals / approvals/ApprovalTests.cpp
`APPROVAL_TESTS_USE_REPORTER` should override the default reporter
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 339
- Forks
- 55
- PR merge metrics
- No merged PRs in 30d
Description
My entire team prefers to use just the TextDiffReporter for day-to-day development, so we would like to do this in the code:
auto defaultReporter = ApprovalTests::Approvals::useAsFrontLoadedReporter(
std::make_shared<ApprovalTests::TextDiffReporter>());
However we would also like to use the APPROVAL_TESTS_USE_REPORTER environment variable to run with the AutoApproveIfMissingReporter when adding new tests, or AutoApproveReporter if we are making some bulk changes to our output. Or maybe in certain use cases or for certain developers they want to use a regular diff tool again. We would prefer not to have to do this via code because it ends up creating local changes that can be accidentally committed etc. And an #ifdef seems not so great if the environment variable is already provided.
But APPROVAL_TESTS_USE_REPORTER does not seem to override this default. It seems like it should to me.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing ApprovalTests::Approvals::useAsFrontLoadedReporter and the handling of APPROVAL_TESTS_USE_REPORTER. Confirm how the default reporter and environment-selected reporter are resolved; done means the environment variable takes precedence without requiring local code changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100