Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nuget/updater/common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function Get-SdkVersionsToInstall([string] $repoRoot, [string[]] $updateDirector
foreach ($globalJsonPath in $globalJsonPaths) {
$resolvedGlobalJsonPath = Convert-Path "$repoRoot/$globalJsonPath"
Write-LogMessage " Processing $globalJsonPath (resolved to $resolvedGlobalJsonPath) for SDK version information"
$globalJson = Get-Content $resolvedGlobalJsonPath | ConvertFrom-Json
$globalJson = Get-Content $resolvedGlobalJsonPath -Raw | ConvertFrom-Json
if (@($globalJson.PSobject.Properties).Count -eq 0) {
Write-LogMessage " No properties found in $globalJsonPath, skipping"
continue
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// this is a leading comment
{
"sdk": {
"version": "1.2.3-leading-comment"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

{
"sdk": {
"version": "1.2.3-leading-newline"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"sdk": {
"version": "1.2.3-leading-whitespace"
}
}
9 changes: 9 additions & 0 deletions nuget/updater/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ $ErrorActionPreference = "Stop"

. $PSScriptRoot\common.ps1

# uncomment line to enable detailed test logging
#$env:DEPENDABOT_LOG_MESSAGES = "true"

function Assert-ArraysEqual([string[]]$expected, [string[]]$actual) {
$expectedText = $expected -join ", "
$actualText = $actual -join ", "
Expand Down Expand Up @@ -102,6 +105,12 @@ try {
-installedSdks @("8.0.404") `
-expectedSdksToInstall @("9.0")

Test-GlobalJsonVersions `
-testDirectory "global-json-whitespace" `
-directories @("/leading-comment", "/leading-newline", "/leading-whitespace") `
-installedSdks @("8.0.404") `
-expectedSdksToInstall @("1.2.3-leading-comment", "1.2.3-leading-newline", "1.2.3-leading-whitespace")

Test-RequiredTargetingPacks `
-testDirectory "targeting-packs" `
-expectedTargetingPacks @("Some.Targeting.Pack.Ref/1.0.1", "Some.Other.Targeting.Pack.Ref/1.0.2", "Some.Targeting.Pack.Ref/4.0.1", "Some.Other.Targeting.Pack.Ref/4.0.2")
Expand Down
Loading