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
Options in the PesterConfiguration-object includes a IsOriginalValue() to indicate if they have been modified by the user, even if the option currently has equal value to the default.
If a user directly modifies the Value-property which holds the current value on a option, this flag isn't flipped like it should be. This affects any "auto" logic for options and merging of configuration.
Describe your environment
Pester version : 5.2.0 C:\Users\Frode\Documents\PowerShell\Modules\pester\5.2.0\Pester.psm1
PowerShell version : 7.1.3
OS version : Microsoft Windows NT 10.0.19042.0
Also in latest 5.3.0 alpha.
Steps to reproduce
$c= (New-PesterConfiguration)
$c.Run.Path; write-Host"Original: $($c.Run.Path.IsOriginalValue())"-ForegroundColor Yellow
Original: True
Default Description Value
-----------------------
{.} Directories to be searched for tests, paths directly to test files, or combination of both. {.}
$c.Run.Path.Value='Something new'$c.Run.Path; write-Host"Original: $($c.Run.Path.IsOriginalValue())"-ForegroundColor Yellow
Original: True
Default Description Value
-----------------------
{.} Directories to be searched for tests, paths directly to test files, or combination of both. {Something new}
Expected Behavior
IsOriginalValue() should not say true when value has been modified
Current Behavior
IsOriginalValue() says true when it should be false
Possible Solution? (optional)
This is caused by the assumption that all values is set using the option-property itself which uses constructors to cast values of different types and not that the user can modify the Value-property directly. The logic that flips the _isOriginalValue flag is only done in the constructors. Two possible solutions:
This will likely break my deserializer. There are tests for the deserializer, but it currently depends on being able to set Value.
Replacing section.configurationItem.Value = ... with section.configurationItem = ... should fix that. Accepted values types will be casted and assigned to the Value-property automatically.
General summary of the issue
Options in the PesterConfiguration-object includes a
IsOriginalValue()
to indicate if they have been modified by the user, even if the option currently has equal value to the default.If a user directly modifies the Value-property which holds the current value on a option, this flag isn't flipped like it should be. This affects any "auto" logic for options and merging of configuration.
Describe your environment
Pester version : 5.2.0 C:\Users\Frode\Documents\PowerShell\Modules\pester\5.2.0\Pester.psm1
PowerShell version : 7.1.3
OS version : Microsoft Windows NT 10.0.19042.0
Also in latest 5.3.0 alpha.
Steps to reproduce
Expected Behavior
IsOriginalValue()
should not say true when value has been modifiedCurrent Behavior
IsOriginalValue()
says true when it should be falsePossible Solution? (optional)
This is caused by the assumption that all values is set using the option-property itself which uses constructors to cast values of different types and not that the user can modify the Value-property directly. The logic that flips the
_isOriginalValue
flag is only done in the constructors. Two possible solutions:_isOriginalValue
in the setter of Value in https://github.com/pester/Pester/blob/main/src/csharp/Pester/GenericOption.csHaving access to modify Value makes it easy to modify some array-options, but it's not critical. Ex.
The text was updated successfully, but these errors were encountered: