Skip to content

Commit 39d9443

Browse files
committed
Whoops, fix the new paths for linux
1 parent 26bbb14 commit 39d9443

File tree

3 files changed

+22
-19
lines changed

3 files changed

+22
-19
lines changed

RequiredModules.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
@{
33
"Configuration" = "[1.3.1,2.0)"
44
"ModuleBuilder" = "1.*"
5-
"Pester" = "[4.5.0,5.0)"
5+
"Pester" = "[4.10.1,5.0)"
66
"PowerShellGet" = "2.0.4"
77
"PSScriptAnalyzer" = "1.*"
88
}

Tests/Public/Convert-CodeCoverage.Tests.ps1

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
Describe "Convert-CodeCoverage" {
22
# use the integration test code
33
BeforeAll {
4-
Build-Module $PSScriptRoot\..\Integration\Source1\build.psd1 -Passthru
4+
Build-Module $PSScriptRoot/../Integration/Source1/build.psd1 -Passthru
55
Push-Location $PSScriptRoot -StackName Convert-CodeCoverage
6+
${global:\} = [io.path]::DirectorySeparatorChar
67
}
78
AfterAll {
89
Pop-Location -StackName Convert-CodeCoverage
910
}
1011

1112
It 'Should extract code coverage from Pester objects and add Source conversions' {
12-
$ModulePath = Convert-Path ".\..\Integration\Result1\Source1\1.0.0\Source1.psm1"
13-
$ModuleSource = Convert-Path ".\..\Integration\Source1"
13+
$ModulePath = Convert-Path "./../Integration/Result1/Source1/1.0.0/Source1.psm1"
14+
$ModuleSource = Convert-Path "./../Integration/Source1"
1415

1516
# Note: Pester does not currently apply custom types...
1617
$PesterResults = [PSCustomObject]@{
@@ -26,7 +27,7 @@ Describe "Convert-CodeCoverage" {
2627
$SourceLocation = $PesterResults | Convert-CodeCoverage -SourceRoot $ModuleSource
2728

2829
# Needs to match the actual module source (on line 25)
29-
$SourceLocation.SourceFile | Should -Be ".\Public\Get-Source.ps1"
30+
$SourceLocation.SourceFile | Should -Be ".${\}Public${\}Get-Source.ps1"
3031
$SourceLocation.Line | Should -Be 5
3132
}
3233
}

Tests/Public/Convert-LineNumber.Tests.ps1

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,24 @@
22
Describe "Convert-LineNumber" {
33
# use the integration test code
44
BeforeAll {
5-
Build-Module $PSScriptRoot\..\Integration\Source1\build.psd1 -Passthru
5+
Build-Module $PSScriptRoot/../Integration/Source1/build.psd1 -Passthru
66
Push-Location $PSScriptRoot -StackName Convert-CodeCoverage
77

8-
$global:Convert_LineNumber_ModulePath = Convert-Path ".\..\Integration\Result1\Source1\1.0.0\Source1.psm1"
9-
$global:Convert_LineNumber_ModuleSource = Convert-Path ".\..\Integration\Source1"
8+
$global:Convert_LineNumber_ModulePath = Convert-Path "./../Integration/Result1/Source1/1.0.0/Source1.psm1"
9+
$global:Convert_LineNumber_ModuleSource = Convert-Path "./../Integration/Source1"
1010
$global:Convert_LineNumber_ModuleContent = Get-Content $global:Convert_LineNumber_ModulePath
11+
${global:\} = [io.path]::DirectorySeparatorChar
12+
13+
$global:TestCases = @(
14+
@{ outputLine = 6; sourceFile = ".${\}Private${\}GetFinale.ps1"; sourceLine = 4 }
15+
@{ outputLine = 18; sourceFile = ".${\}Private${\}GetPreview.ps1"; sourceLine = 7 }
16+
@{ outputLine = 25; sourceFile = ".${\}Public${\}Get-Source.ps1"; sourceLine = 5 }
17+
)
1118
}
1219
AfterAll {
1320
Pop-Location -StackName Convert-CodeCoverage
1421
}
1522

16-
$TestCases = @(
17-
@{ outputLine = 6; sourceFile = ".\Private\GetFinale.ps1"; sourceLine = 4 }
18-
@{ outputLine = 18; sourceFile = ".\Private\GetPreview.ps1"; sourceLine = 7 }
19-
@{ outputLine = 25; sourceFile = ".\Public\Get-Source.ps1"; sourceLine = 5 }
20-
)
2123

2224
It "Should map line <outputLine> in the Module to line <sourceLine> in the source of <sourceFile>" -TestCases $TestCases {
2325
param($outputLine, $sourceFile, $sourceLine)
@@ -35,30 +37,30 @@ Describe "Convert-LineNumber" {
3537
}
3638

3739
It "Should throw if the SourceFile doesn't exist" {
38-
{ Convert-LineNumber -SourceFile TestDrive:\NoSuchFile -SourceLineNumber 10 } |
39-
Should -Throw "'TestDrive:\NoSuchFile' does not exist"
40+
{ Convert-LineNumber -SourceFile TestDrive:/NoSuchFile -SourceLineNumber 10 } |
41+
Should -Throw "'TestDrive:/NoSuchFile' does not exist"
4042
}
4143

4244
It 'Should work with an error PositionMessage' {
4345
$line = Select-String -Path $Convert_LineNumber_ModulePath 'function Set-Source {' | ForEach-Object LineNumber
4446

4547
$SourceLocation = "At ${Convert_LineNumber_ModulePath}:$line char:17" | Convert-LineNumber
4648
# This test is assuming you built the code on Windows. Should Convert-LineNumber convert the path?
47-
$SourceLocation.SourceFile | Should -Be ".\Public\Set-Source.ps1"
49+
$SourceLocation.SourceFile | Should -Be ".${\}Public${\}Set-Source.ps1"
4850
$SourceLocation.SourceLineNumber | Should -Be 1
4951
}
5052

5153
It 'Should work with ScriptStackTrace messages' {
5254

53-
$SourceFile = Join-Path $Convert_LineNumber_ModuleSource Public\Set-Source.ps1 | Convert-Path
55+
$SourceFile = Join-Path $Convert_LineNumber_ModuleSource Public/Set-Source.ps1 | Convert-Path
5456

5557
$outputLine = Select-String -Path $Convert_LineNumber_ModulePath "sto͞o′pĭd" | % LineNumber
5658
$sourceLine = Select-String -Path $SourceFile "sto͞o′pĭd" | % LineNumber
5759

5860
$SourceLocation = "At Set-Source, ${Convert_LineNumber_ModulePath}: line $outputLine" | Convert-LineNumber
5961

6062
# This test is assuming you built the code on Windows. Should Convert-LineNumber convert the path?
61-
$SourceLocation.SourceFile | Should -Be ".\Public\Set-Source.ps1"
63+
$SourceLocation.SourceFile | Should -Be ".${\}Public${\}Set-Source.ps1"
6264
$SourceLocation.SourceLineNumber | Should -Be $sourceLine
6365
}
6466

@@ -73,7 +75,7 @@ Describe "Convert-LineNumber" {
7375

7476
$SourceLocation = $PesterMiss | Convert-LineNumber -Passthru
7577
# This test is assuming you built the code on Windows. Should Convert-LineNumber convert the path?
76-
$SourceLocation.SourceFile | Should -Be ".\Public\Get-Source.ps1"
78+
$SourceLocation.SourceFile | Should -Be ".${\}Public${\}Get-Source.ps1"
7779
$SourceLocation.SourceLineNumber | Should -Be 5
7880
$SourceLocation.Function | Should -Be 'Get-Source'
7981
}

0 commit comments

Comments
 (0)