Skip to content

Commit 4e9c41a

Browse files
author
kborle
committed
Fixes "Test Path" tests failure.
"When given a glob" and "When given a FileSystem PSDrive" were failing because the files on which Invoke-ScriptAnalyzer was invoked had changed.
1 parent d265818 commit 4e9c41a

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

Tests/Engine/InvokeScriptAnalyzer.tests.ps1

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,10 @@ Describe "Test Path" {
8787

8888
Context "When given a glob" {
8989
It "Invokes on all the matching files" {
90-
$numFilesResult = (Invoke-ScriptAnalyzer -Path $directory\Rule*.ps1 | Select-Object -Property ScriptName -Unique).Count
91-
$numFilesExpected = (Get-ChildItem -Path $directory\Rule*.ps1).Count
90+
$numFilesResult = (Invoke-ScriptAnalyzer -Path $directory\TestTestPath*.ps1 | Select-Object -Property ScriptName -Unique).Count
91+
Write-HOst "Number of files processed"
92+
Write-Host $numFilesResult
93+
$numFilesExpected = (Get-ChildItem -Path $directory\TestTestPath*.ps1).Count
9294
$numFilesResult | Should be $numFilesExpected
9395
}
9496
}
@@ -98,8 +100,8 @@ Describe "Test Path" {
98100
$freeDriveNameLen = 2
99101
$freeDrive, $freeDriveName = GetFreeDrive $freeDriveNameLen
100102
New-PSDrive -Name $freeDriveName -PSProvider FileSystem -Root $directory
101-
$numFilesExpected = (Get-ChildItem -Path $freeDrive\R*.ps1).Count
102-
$numFilesResult = (Invoke-ScriptAnalyzer -Path $freeDrive\Rule*.ps1 | Select-Object -Property ScriptName -Unique).Count
103+
$numFilesExpected = (Get-ChildItem -Path $freeDrive\TestTestPath*.ps1).Count
104+
$numFilesResult = (Invoke-ScriptAnalyzer -Path $freeDrive\TestTestPath*.ps1 | Select-Object -Property ScriptName -Unique).Count
103105
Remove-PSDrive $freeDriveName
104106
$numFilesResult | Should Be $numFilesExpected
105107
}

Tests/Engine/TestTestPath1.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
gci

Tests/Engine/TestTestPath2.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ConvertTo-SecureString -AsPlainText "123456" -Force

0 commit comments

Comments
 (0)