You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using ShouldMatchSnapshot passing in a SnapshotSetting in cases when the stack trace cannot be used to detect the test name, the SupportedTestMethodNotFoundException gets thrown.
To Reproduce
Snapper.dll!Snapper.Core.TestMethodResolver.TestMethodResolver.ResolveTestMethod() Line 55 C#
Snapper.dll!Snapper.Core.SnapshotUpdateDecider.ShouldUpdateSnapshotBasedOnAttribute() Line 46 C#
Snapper.dll!Snapper.Core.SnapshotUpdateDecider.ShouldUpdateSnapshot() Line 30 C#
Snapper.dll!Snapper.Core.SnapperCore.ShouldUpdateSnapshot(Snapper.Json.JsonSnapshot existingSnapshot, Snapper.Json.JsonSnapshot newSnapshot) Line 40 C#
Snapper.dll!Snapper.Core.SnapperCore.Snap(Snapper.Json.JsonSnapshot newSnapshot) Line 20 C#
Snapper.dll!Snapper.Snapper.MatchSnapshot(object rawSnapshot, string childSnapshotName) Line 21 C#
Snapper.dll!Snapper.SnapperExtensions.ShouldMatchChildSnapshot(object snapshot, string childSnapshotName, Snapper.SnapshotSettings snapshotSettings) Line 22 C#
Correction I can't work-around this using environment variable, because the logic checks if either attribute or environment variable specifies to update snapshot.
I suggest changing the ShouldUpdateSnapshot() logic to respect the environment variable if it is not null, and short-circuit the decision. i.e. if environment is not set, the check the attribute. If it is explicitly set to false, don't update the snapshots.
Is it worth considering accepting a MethodInfo property in SnapshotSetting of the property?
Describe the bug
When using
ShouldMatchSnapshot
passing in aSnapshotSetting
in cases when the stack trace cannot be used to detect the test name, the SupportedTestMethodNotFoundException gets thrown.To Reproduce
Correction I can't work-around this using environment variable, because the logic checks if either attribute or environment variable specifies to update snapshot.
I suggest changing the
ShouldUpdateSnapshot()
logic to respect the environment variable if it is not null, and short-circuit the decision. i.e. if environment is not set, the check the attribute. If it is explicitly set to false, don't update the snapshots.Is it worth considering accepting a
MethodInfo
property inSnapshotSetting
of the property?Additional context
Snapper Version: 2.4.0
Operation System: Windows 11
.Net Version: .net core 7
The text was updated successfully, but these errors were encountered: