From d367b952d24fa485e69549277fa6cca8bf119388 Mon Sep 17 00:00:00 2001 From: mazhelez Date: Thu, 8 Feb 2024 17:19:36 +0100 Subject: [PATCH] Set dependencies version in app manifest files (app.json) --- .../IncrementVersionNumber.ps1 | 20 ++- .../IncrementVersionNumber.psm1 | 79 +++++------ Tests/IncrementVersionNumber.Action.Test.ps1 | 124 +++++++++--------- 3 files changed, 121 insertions(+), 102 deletions(-) diff --git a/Actions/IncrementVersionNumber/IncrementVersionNumber.ps1 b/Actions/IncrementVersionNumber/IncrementVersionNumber.ps1 index 97bdf987e..d7fb2d5c1 100644 --- a/Actions/IncrementVersionNumber/IncrementVersionNumber.ps1 +++ b/Actions/IncrementVersionNumber/IncrementVersionNumber.ps1 @@ -34,21 +34,35 @@ try { } # Change repoVersion in repository settings - Set-VersionSettingInFile -settingsFilePath (Join-Path $baseFolder $RepoSettingsFile) -settingName 'repoVersion' -newValue $versionNumber # $RepoSettingsFile is defined in AL-Go-Helper.ps1 + Set-VersionInSettingsFile -settingsFilePath (Join-Path $baseFolder $RepoSettingsFile) -settingName 'repoVersion' -newValue $versionNumber | Out-Null # $RepoSettingsFile is defined in AL-Go-Helper.ps1 $settings = $env:Settings | ConvertFrom-Json $projectList = @(GetProjectsFromRepository -baseFolder $baseFolder -projectsFromSettings $settings.projects -selectProjects $projects) + $allAppFolders = @() foreach($project in $projectList) { + $projectPath = Join-Path $baseFolder $project + + # Set repoVersion in project settings (if it exists) + $projectSettingsPath = Join-Path $projectPath $ALGoSettingsFile # $ALGoSettingsFile is defined in AL-Go-Helper.ps1 + Set-VersionInSettingsFile -settingsFilePath $projectSettingsPath -settingName 'repoVersion' -newValue $newVersion + # Resolve project folders to get all app folders that contain an app.json file $projectSettings = ReadSettings -baseFolder $baseFolder -project $project ResolveProjectFolders -baseFolder $baseFolder -project $project -projectSettings ([ref] $projectSettings) - $projectPath = Join-Path $baseFolder $project + # Set version in app manifests (app.json files) + Set-VersionInAppManifests -projectPath $projectPath -projectSettings $projectSettings -newValue $newVersion - Set-ProjectVersion -projectPath $projectPath -projectSettings $projectSettings -newVersion $versionNumber -ALGOsettingsFile $ALGoSettingsFile # $ALGoSettingsFile is defined in AL-Go-Helper.ps1 + # Collect all project's app folders + $allAppFolders += $projectSettings.appFolders | ForEach-Object { Join-Path $projectPath $_ -Resolve } + $allAppFolders += $projectSettings.testFolders | ForEach-Object { Join-Path $projectPath $_ -Resolve } + $allAppFolders += $projectSettings.bcptTestFolders | ForEach-Object { Join-Path $projectPath $_ -Resolve } } + # Set dependencies in app manifests + Set-DependenciesVersionInAppManifests -allAppFolders $allAppFolders + $commitMessage = "New Version number $versionNumber" if ($versionNumber.StartsWith('+')) { $commitMessage = "Incremented Version number by $versionNumber" diff --git a/Actions/IncrementVersionNumber/IncrementVersionNumber.psm1 b/Actions/IncrementVersionNumber/IncrementVersionNumber.psm1 index 87214c07a..000eb9ab5 100644 --- a/Actions/IncrementVersionNumber/IncrementVersionNumber.psm1 +++ b/Actions/IncrementVersionNumber/IncrementVersionNumber.psm1 @@ -2,13 +2,13 @@ .Synopsis Changes a version setting value in a settings file. .Parameter settingsFilePath - Path to the settings file. The settings file must be a JSON file. + Path to a JSON file containing the settings. .Parameter settingName Name of the setting to change. The setting must be a version number. .Parameter newValue New value of the setting. Allowed values are: +1 (increment major version number), +0.1 (increment minor version number), or a version number in the format Major.Minor (e.g. 1.0 or 1.2 #> -function Set-VersionSettingInFile { +function Set-VersionInSettingsFile { param( [Parameter(Mandatory = $true, ValueFromPipeline = $true)] [string] $settingsFilePath, @@ -90,12 +90,6 @@ function Set-VersionSettingInFile { Write-Host "Changing $settingName from $oldValue to $newValue in $settingsFilePath" $settingFileContent.$settingName = $newValue.ToString() $settingFileContent | Set-JsonContentLF -Path $settingsFilePath - - return @{ - name = $settingFileContent.name - version = $settingFileContent.version - publisher = $settingFileContent.publisher - } } <# @@ -108,50 +102,61 @@ function Set-VersionSettingInFile { Base folder of the repository. .Parameter project Name of the project (relative to the base folder). - .Parameter newVersion + .Parameter newValue New version number. If the version number starts with a +, the new version number will be added to the old version number. Else the new version number will replace the old version number. #> -function Set-ProjectVersion($projectPath, $projectSettings, $newVersion, $ALGOsettingsFile) { - # Set repoVersion in project settings (if it exists) - $projectSettingsPath = Join-Path $projectPath $ALGoSettingsFile - Set-VersionSettingInFile -settingsFilePath $projectSettingsPath -settingName 'repoVersion' -newValue $newVersion | Out-Null +function Set-VersionInAppManifests($projectPath, $projectSettings, $newValue) { # Check if the project uses repoVersion versioning strategy $useRepoVersion = (($projectSettings.PSObject.Properties.Name -eq "versioningStrategy") -and (($projectSettings.versioningStrategy -band 16) -eq 16)) if ($useRepoVersion) { - $newVersion = $projectSettings.repoVersion + $newValue = $projectSettings.repoVersion } $allAppFolders = @($projectSettings.appFolders) + @($projectSettings.testFolders) + @($projectSettings.bcptTestFolders) # Set version in app.json files - $appInfos = $allAppFolders | ForEach-Object { - $folder = Join-Path $projectPath $_ - $appJsonFile = Join-Path $folder "app.json" + $allAppFolders | ForEach-Object { + $appFolder = Join-Path $projectPath $_ + $appJson = Join-Path $appFolder "app.json" - $appInfo = Set-VersionSettingInFile -settingsFilePath $appJsonFile -settingName 'version' -newValue $newVersion - return $appInfo + Set-VersionInSettingsFile -settingsFilePath $appJson -settingName 'version' -newValue $newValue } +} - # Set the version in the dependencies in app.json files - $allAppFolders | ForEach-Object { - $folder = Join-Path $projectPath $_ - $appJsonFile = Join-Path $folder "app.json" - - $appJsonContent = Get-Content $appJsonFile -Raw -Encoding UTF8 | ConvertFrom-Json - $dependencies = $appJsonContent.dependencies - if ($null -ne $dependencies) { - $dependencies | ForEach-Object { - $dependency = $_ - # Find the version of the dependency in the appInfos. If it's found, it means the dependency is part of the project and the version should be set. - $dependencyAppInfo = $appInfos | Where-Object { $_.name -eq $dependency.name -and $_.publisher -eq $dependency.publisher } - if ($null -ne $dependencyAppInfo) { - $dependency.version = $dependencyAppInfo.version - } +function Set-DependenciesVersionInAppManifests { + param( + [Parameter(Mandatory = $true)] + [string[]] $appFolders + ) + + # Get all apps info: app ID and app version + $appsInfos = @($appFolders | ForEach-Object { + $appJson = Join-Path $_ "app.json" + $app = Get-Content -Path $appJson -Raw | ConvertFrom-Json + return [PSCustomObject]@{ + Id = $app.id + Version = $app.version + } + }) + + # Update dependencies in app.json files + $appFolders | ForEach-Object { + $appJsonPath = Join-Path $_ "app.json" + + $appJson = Get-Content -Path $appJsonPath -Raw | ConvertFrom-Json + + $dependencies = $appJson.dependencies + + $dependencies | ForEach-Object { + $dependency = $_ + $appInfo = $appsInfos | Where-Object { $_.Id -eq $dependency.id } + if ($appInfo) { + $dependency.version = $appInfo.Version } - $appJsonContent.dependencies = $dependencies - $appJsonContent | Set-JsonContentLF -Path $appJsonFile } + + $appJson | ConvertTo-Json -Depth 99 | Set-Content -Path $appJsonPath } } -Export-ModuleMember -Function Set-VersionSettingInFile, Set-ProjectVersion \ No newline at end of file +Export-ModuleMember -Function Set-VersionInSettingsFile, Set-VersionInAppManifests, Set-DependenciesVersionInAppManifests \ No newline at end of file diff --git a/Tests/IncrementVersionNumber.Action.Test.ps1 b/Tests/IncrementVersionNumber.Action.Test.ps1 index 25624e779..683a9451d 100644 --- a/Tests/IncrementVersionNumber.Action.Test.ps1 +++ b/Tests/IncrementVersionNumber.Action.Test.ps1 @@ -29,207 +29,207 @@ Describe "IncrementVersionNumber Action Tests" { # Call action } -Describe "Set-VersionSettingInFile tests" { +Describe "Set-VersionInSettingsFile tests" { BeforeAll { . (Join-Path -Path $PSScriptRoot -ChildPath "..\Actions\AL-Go-Helper.ps1" -Resolve) Import-Module (Join-Path -path $PSScriptRoot -ChildPath "..\Actions\IncrementVersionNumber\IncrementVersionNumber.psm1" -Resolve) -Force - $settingsFilePath = "" # Might be used in tests, used in AfterEach + $settingsFile = "" # Might be used in tests, used in AfterEach - function New-TestSettingsFile { + function New-TestSettingsFilePath { param( [string] $repoVersion = '0.1' ) # Create test JSON settings file in the temp folder - $settingsFilePath = Join-Path ([System.IO.Path]::GetTempPath()) "$([Guid]::NewGuid().ToString()).json" + $settingsFile = Join-Path ([System.IO.Path]::GetTempPath()) "$([Guid]::NewGuid().ToString()).json" $settingsFileContent = [ordered]@{ "repoVersion" = $repoVersion "otherSetting" = "otherSettingValue" } - $settingsFileContent | ConvertTo-Json | Set-Content $settingsFilePath -Encoding UTF8 + $settingsFileContent | ConvertTo-Json | Set-Content $settingsFile -Encoding UTF8 - return $settingsFilePath + return $settingsFile } } - It 'Set-VersionSettingInFile -settingsFilePath not found' { - $nonExistingFile = Join-Path ([System.IO.Path]::GetTempPath()) "UnknownFile.json" + It 'Set-VersionInSettingsFile -settingsFilePath not found' { + $nonExistingFile = Join-Path ([System.IO.Path]::GetTempPath()) "unknown.json" $settingName = 'repoVersion' $newValue = '1.0' - { Set-VersionSettingInFile -settingsFilePath $nonExistingFile -settingName $settingName -newValue $newValue } | Should -Throw "Settings file ($nonExistingFile) not found." + { Set-VersionInSettingsFile -settingsFilePath $nonExistingFile -settingName $settingName -newValue $newValue } | Should -Throw "Settings file ($nonExistingFile) not found." } - It 'Set-VersionSettingInFile -settingName not found' { - $settingsFilePath = New-TestSettingsFile + It 'Set-VersionInSettingsFile version setting not found' { + $settingsFile = New-TestSettingsFilePath $settingName = 'repoVersion2' $newValue = '1.0' - { Set-VersionSettingInFile -settingsFilePath $settingsFilePath -settingName $settingName -newValue $newValue } | Should -Not -Throw + { Set-VersionInSettingsFile -settingsFilePath $settingsFile -settingName $settingName -newValue $newValue } | Should -Not -Throw - $newSettingsContent = Get-Content $settingsFilePath -Encoding UTF8 | ConvertFrom-Json + $newSettingsContent = Get-Content $settingsFile -Encoding UTF8 | ConvertFrom-Json $newSettingsContent | Should -Not -Contain $settingName # Check that the other setting are not changed $newSettingsContent.otherSetting | Should -Be "otherSettingValue" $newSettingsContent.repoVersion | Should -Be "0.1" } - It 'Set-VersionSettingInFile -newValue +0.2 is not allowed' { - $settingsFilePath = New-TestSettingsFile + It 'Set-VersionInSettingsFile -newValue +0.2 is not allowed' { + $settingsFile = New-TestSettingsFilePath $settingName = 'repoVersion' $newValue = '+0.2' - { Set-VersionSettingInFile -settingsFilePath $settingsFilePath -settingName $settingName -newValue $newValue } | Should -Throw "Incremental version number $newValue is not allowed. Allowed incremental version numbers are: +1, +0.1" + { Set-VersionInSettingsFile -settingsFilePath $settingsFile -settingName $settingName -newValue $newValue } | Should -Throw "Incremental version number $newValue is not allowed. Allowed incremental version numbers are: +1, +0.1" # Check that the settings are not changed - $newSettingsContent = Get-Content $settingsFilePath -Encoding UTF8 | ConvertFrom-Json + $newSettingsContent = Get-Content $settingsFile -Encoding UTF8 | ConvertFrom-Json $newSettingsContent.$settingName | Should -Be "0.1" $newSettingsContent.otherSetting | Should -Be "otherSettingValue" } - It 'Set-VersionSettingInFile -newValue +3 is not allowed' { - $settingsFilePath = New-TestSettingsFile + It 'Set-VersionInSettingsFile -newValue +3 is not allowed' { + $settingsFile = New-TestSettingsFilePath $settingName = 'repoVersion' $newValue = '+3' - { Set-VersionSettingInFile -settingsFilePath $settingsFilePath -settingName $settingName -newValue $newValue } | Should -Throw "Incremental version number $newValue is not allowed. Allowed incremental version numbers are: +1, +0.1" + { Set-VersionInSettingsFile -settingsFilePath $settingsFile -settingName $settingName -newValue $newValue } | Should -Throw "Incremental version number $newValue is not allowed. Allowed incremental version numbers are: +1, +0.1" # Check that the settings are not changed - $newSettingsContent = Get-Content $settingsFilePath -Encoding UTF8 | ConvertFrom-Json + $newSettingsContent = Get-Content $settingsFile -Encoding UTF8 | ConvertFrom-Json $newSettingsContent.$settingName | Should -Be "0.1" $newSettingsContent.otherSetting | Should -Be "otherSettingValue" } - It 'Set-VersionSettingInFile -newValue 1.2.3 is not allowed' { - $settingsFilePath = New-TestSettingsFile + It 'Set-VersionInSettingsFile -newValue 1.2.3 is not allowed' { + $settingsFile = New-TestSettingsFilePath $settingName = 'repoVersion' $newValue = '1.2.3' - { Set-VersionSettingInFile -settingsFilePath $settingsFilePath -settingName $settingName -newValue $newValue } | Should -Throw "Version number $newValue is not in the correct format. The version number must be in the format Major.Minor (e.g. 1.0 or 1.2)" + { Set-VersionInSettingsFile -settingsFilePath $settingsFile -settingName $settingName -newValue $newValue } | Should -Throw "Version number $newValue is not in the correct format. The version number must be in the format Major.Minor (e.g. 1.0 or 1.2)" # Check that the settings are not changed - $newSettingsContent = Get-Content $settingsFilePath -Encoding UTF8 | ConvertFrom-Json + $newSettingsContent = Get-Content $settingsFile -Encoding UTF8 | ConvertFrom-Json $newSettingsContent.$settingName | Should -Be "0.1" $newSettingsContent.otherSetting | Should -Be "otherSettingValue" } - It 'Set-VersionSettingInFile -newValue -1 is not allowed' { - $settingsFilePath = New-TestSettingsFile + It 'Set-VersionInSettingsFile -newValue -1 is not allowed' { + $settingsFile = New-TestSettingsFilePath $settingName = 'repoVersion' $newValue = '-1' - { Set-VersionSettingInFile -settingsFilePath $settingsFilePath -settingName $settingName -newValue $newValue } | Should -Throw "Version number $newValue is not in the correct format. The version number must be in the format Major.Minor (e.g. 1.0 or 1.2)" + { Set-VersionInSettingsFile -settingsFilePath $settingsFile -settingName $settingName -newValue $newValue } | Should -Throw "Version number $newValue is not in the correct format. The version number must be in the format Major.Minor (e.g. 1.0 or 1.2)" # Check that the settings are not changed - $newSettingsContent = Get-Content $settingsFilePath -Encoding UTF8 | ConvertFrom-Json + $newSettingsContent = Get-Content $settingsFile -Encoding UTF8 | ConvertFrom-Json $newSettingsContent.$settingName | Should -Be "0.1" $newSettingsContent.otherSetting | Should -Be "otherSettingValue" } - It 'Set-VersionSettingInFile -newValue -1 is not allowed' { - $settingsFilePath = New-TestSettingsFile + It 'Set-VersionInSettingsFile -newValue -1 is not allowed' { + $settingsFile = New-TestSettingsFilePath $settingName = 'repoVersion' $newValue = '-1' - { Set-VersionSettingInFile -settingsFilePath $settingsFilePath -settingName $settingName -newValue $newValue } | Should -Throw "Version number $newValue is not in the correct format. The version number must be in the format Major.Minor (e.g. 1.0 or 1.2)" + { Set-VersionInSettingsFile -settingsFilePath $settingsFile -settingName $settingName -newValue $newValue } | Should -Throw "Version number $newValue is not in the correct format. The version number must be in the format Major.Minor (e.g. 1.0 or 1.2)" # Check that the settings are not changed - $newSettingsContent = Get-Content $settingsFilePath -Encoding UTF8 | ConvertFrom-Json + $newSettingsContent = Get-Content $settingsFile -Encoding UTF8 | ConvertFrom-Json $newSettingsContent.$settingName | Should -Be "0.1" $newSettingsContent.otherSetting | Should -Be "otherSettingValue" } - It 'Set-VersionSettingInFile -newValue abcd is not allowed' { - $settingsFilePath = New-TestSettingsFile + It 'Set-VersionInSettingsFile -newValue abcd is not allowed' { + $settingsFile = New-TestSettingsFilePath $settingName = 'repoVersion' $newValue = 'abcd' - { Set-VersionSettingInFile -settingsFilePath $settingsFilePath -settingName $settingName -newValue $newValue } | Should -Throw "Version number $newValue is not in the correct format. The version number must be in the format Major.Minor (e.g. 1.0 or 1.2)" + { Set-VersionInSettingsFile -settingsFilePath $settingsFile -settingName $settingName -newValue $newValue } | Should -Throw "Version number $newValue is not in the correct format. The version number must be in the format Major.Minor (e.g. 1.0 or 1.2)" # Check that the settings are not changed - $newSettingsContent = Get-Content $settingsFilePath -Encoding UTF8 | ConvertFrom-Json + $newSettingsContent = Get-Content $settingsFile -Encoding UTF8 | ConvertFrom-Json $newSettingsContent.$settingName | Should -Be "0.1" $newSettingsContent.otherSetting | Should -Be "otherSettingValue" } - It 'Set-VersionSettingInFile -newValue a.b is not allowed' { - $settingsFilePath = New-TestSettingsFile + It 'Set-VersionInSettingsFile -newValue a.b is not allowed' { + $settingsFile = New-TestSettingsFilePath $settingName = 'repoVersion' $newValue = 'a.b' - { Set-VersionSettingInFile -settingsFilePath $settingsFilePath -settingName $settingName -newValue $newValue } | Should -Throw "Version number $newValue is not in the correct format. The version number must be in the format Major.Minor (e.g. 1.0 or 1.2)" + { Set-VersionInSettingsFile -settingsFilePath $settingsFile -settingName $settingName -newValue $newValue } | Should -Throw "Version number $newValue is not in the correct format. The version number must be in the format Major.Minor (e.g. 1.0 or 1.2)" # Check that the settings are not changed - $newSettingsContent = Get-Content $settingsFilePath -Encoding UTF8 | ConvertFrom-Json + $newSettingsContent = Get-Content $settingsFile -Encoding UTF8 | ConvertFrom-Json $newSettingsContent.$settingName | Should -Be "0.1" $newSettingsContent.otherSetting | Should -Be "otherSettingValue" } - It 'Set-VersionSettingInFile -newValue 1.0 is set' { - $settingsFilePath = New-TestSettingsFile + It 'Set-VersionInSettingsFile -newValue 1.0 is set' { + $settingsFile = New-TestSettingsFilePath $settingName = 'repoVersion' $newValue = '1.0' - Set-VersionSettingInFile -settingsFilePath $settingsFilePath -settingName $settingName -newValue $newValue + Set-VersionInSettingsFile -settingsFilePath $settingsFile -settingName $settingName -newValue $newValue - $newSettingsContent = Get-Content $settingsFilePath -Encoding UTF8 | ConvertFrom-Json + $newSettingsContent = Get-Content $settingsFile -Encoding UTF8 | ConvertFrom-Json $newSettingsContent.$settingName | Should -Be "1.0" # Check that the other setting are not changed $newSettingsContent.otherSetting | Should -Be "otherSettingValue" } - It 'Set-VersionSettingInFile -newValue +1 increments the major version number and sets the minor version number to 0' { - $settingsFilePath = New-TestSettingsFile + It 'Set-VersionInSettingsFile -newValue +1 increments the major version number and sets the minor version number to 0' { + $settingsFile = New-TestSettingsFilePath $settingName = 'repoVersion' $newValue = '+1' - Set-VersionSettingInFile -settingsFilePath $settingsFilePath -settingName $settingName -newValue $newValue + Set-VersionInSettingsFile -settingsFilePath $settingsFile -settingName $settingName -newValue $newValue - $newSettingsContent = Get-Content $settingsFilePath -Encoding UTF8 | ConvertFrom-Json + $newSettingsContent = Get-Content $settingsFile -Encoding UTF8 | ConvertFrom-Json $newSettingsContent.$settingName | Should -Be "1.0" # Check that the other setting are not changed $newSettingsContent.otherSetting | Should -Be "otherSettingValue" } - It 'Set-VersionSettingInFile -newValue +0.1 increments the minor version number' { - $settingsFilePath = New-TestSettingsFile -repoVersion '1.2' + It 'Set-VersionInSettingsFile -newValue +0.1 incremenFilents the minor version number' { + $settingsFile = New-TestSettingsFilePath -repoVersion '1.2' $settingName = 'repoVersion' $newValue = '+0.1' - Set-VersionSettingInFile -settingsFilePath $settingsFilePath -settingName $settingName -newValue $newValue + Set-VersionInSettingsFile -settingsFilePath $settingsFile -settingName $settingName -newValue $newValue - $newSettingsContent = Get-Content $settingsFilePath -Encoding UTF8 | ConvertFrom-Json + $newSettingsContent = Get-Content $settingsFile -Encoding UTF8 | ConvertFrom-Json $newSettingsContent.$settingName | Should -Be "1.3" # Check that the other setting are not changed $newSettingsContent.otherSetting | Should -Be "otherSettingValue" } - It 'Set-VersionSettingInFile -newValue is set and build and revision are kept from the old value'{ - $settingsFilePath = New-TestSettingsFile -repoVersion '1.2.0.0' + It 'Set-VersionInSettingsFile -newValue is set and bnFileuild and revision are kept from the old value'{ + $settingsFile = New-TestSettingsFilePath -repoVersion '1.2.0.0' $settingName = 'repoVersion' $newValue = '2.1' - Set-VersionSettingInFile -settingsFilePath $settingsFilePath -settingName $settingName -newValue $newValue + Set-VersionInSettingsFile -settingsFilePath $settingsFile -settingName $settingName -newValue $newValue - $newSettingsContent = Get-Content $settingsFilePath -Encoding UTF8 | ConvertFrom-Json + $newSettingsContent = Get-Content $settingsFile -Encoding UTF8 | ConvertFrom-Json $newSettingsContent.$settingName | Should -Be "2.1.0.0" # Check that the other setting are not changed $newSettingsContent.otherSetting | Should -Be "otherSettingValue" } - It 'Set-VersionSettingInFile -newValue +0.1 increments the minor version number and build and revision are kept from the old value' { - $settingsFilePath = New-TestSettingsFile -repoVersion '1.2.0.0' + It 'Set-VersionInSettingsFile -newValue +0.1 incremenFilents the minor version number and build and revision are kept from the old value' { + $settingsFile = New-TestSettingsFilePath -repoVersion '1.2.0.0' $settingName = 'repoVersion' $newValue = '+0.1' - Set-VersionSettingInFile -settingsFilePath $settingsFilePath -settingName $settingName -newValue $newValue + Set-VersionInSettingsFile -settingsFilePath $settingsFile -settingName $settingName -newValue $newValue - $newSettingsContent = Get-Content $settingsFilePath -Encoding UTF8 | ConvertFrom-Json + $newSettingsContent = Get-Content $settingsFile -Encoding UTF8 | ConvertFrom-Json $newSettingsContent.$settingName | Should -Be "1.3.0.0" # Check that the other setting are not changed @@ -237,6 +237,6 @@ Describe "Set-VersionSettingInFile tests" { } AfterEach { - Remove-Item $settingsFilePath -Force -ErrorAction Ignore + Remove-Item $settingsFile -Force -ErrorAction Ignore } }