Why UseStrictJson can be set only globally ?
lluthus opened this issue · 1 comments
Discussed in https://github.com/orgs/VerifyTests/discussions/1166
Originally posted by lluthus March 21, 2024
Hello,
I’ve been using the Verify library in several tests created with MSTEST. In one of these tests, I’ve set up a .json result file by adding a setting into the class initializer as follows:
[ClassInitialize] public static void TestInitializer(TestContext context) { VerifierSettings.UseStrictJson(); }
The issue I’m encountering is that executing this test changes the way Verify works globally. This means that all subsequent tests that have a result file as a .txt file are unable to perform the comparison.
I’m looking for a solution where the behavior change isn’t global, but specific to the test, or a method to reset the default value after the test is executed.
Any guidance or suggestions would be greatly appreciated.
Thank you in advance for your help.
this is the first i have heard of anyone wanting it at a per test level. every other use case is people always wanted json for all tests.
can you share your use case in more details. why some tests and not others?