Closed DimRochette closed 4 years ago
Thank you for reporting this. This is another reporter type that will depend on #82 being fixed.
I think the best way to implement this will be to allow locations of Windows exes to be added to the PATH...
Currently, only Unix PATHs are supported, via the use of which
in https://github.com/approvals/ApprovalTests.cpp/blob/f541e8c652c6792763dc307ee89ced94c03ccfa3/ApprovalTests/reporters/CommandReporter.h#L61-L67
The same could be done by adding a where
clause for windows...
Then, so long as the user is running a process after vcvarsall.bat
or similar has been run, vsDiffMerge.exe
will be in the PATH, and we won't have to put in loads of search paths for loads of different Visual Studio versions.
A thing to note: we should only open a Visual Studio diff tool if the tests are being run from within Visual Studio itself, due to the slow start-up time of Visual Studio.
One idea would be to create the reporter, but not add it to the list of auto-detected reporters.
This is the corresponding code in ApprovalTests.Net:
It shows how that library detects whether the test is running from Visual Studio, and if so, how to find the location of the VS installation.
Sorry, we decided that this was too much work to implement robustly, but here is a workaround:
// Use your appropriate path:
auto path = "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/vsDiffMerge.exe";
auto reporter = CustomReporter::create(path);
Approvals::verify("this will open in Visual Studio", *reporter);
Visual studio provide
vsDiffMerge.exe
which is a probably a nightmare to find in path, but could launch visual studio as a merge tool.The command line documentation is explained in this post