ApprovalTests.Java icon indicating copy to clipboard operation
ApprovalTests.Java copied to clipboard

F!! Add auto approve reporter based on system properties

Open zabetak opened this issue 2 years ago • 4 comments

Description

The new reporter will automatically approve the changeset (copy received to approved) when a specified System property is set (to true or it is simply present).

The goal is to allow to update easily all relevant files from the tests that are run, without requiring code changes but in a controlled manner (only when the user explicitly sets the property).

The new auto approver would be very useful for projects using maven, gradle, etc, where system properties can be passed along when running a test. For instance:

mvn test -Dtest=TestMySuperExampleUsingApproval -Dorg.approvaltests.reporters.autoapprove (triggers the auto approver and creates/updates the .aproved files)
mvn test -Dtest=TestMySuperExampleUsingApproval (doesn't trigger the auto approver and if files do not match it simply fails)

zabetak avatar Dec 14 '23 22:12 zabetak

hey, we're back doing weekly sessions to work on ApprovalTests. Would you like to join on a Monday evening (18-20 o'clock), walk us through this PR and get this merged?

LarsEckart avatar Jan 15 '24 17:01 LarsEckart

Monday 22/1 at 19:00 GMT +1 is fine with me. Feel free to send me an invite at [email protected]

zabetak avatar Jan 16 '24 21:01 zabetak

@zabetak FYI this is now possible using environment variable - https://github.com/approvals/ApprovalTests.Java/blob/master/approvaltests/docs/how_to/ConfigureReporters.md#method-4-environment-variables

maio avatar Aug 21 '24 17:08 maio