Skip to content

Commit 78c8afb

Browse files
author
JustinGrote
committed
Don't Test if not built
1 parent a7559a6 commit 78c8afb

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

PSModule.build.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,10 @@ task UpdateMetadata CopyFilesToBuildDir,Version,{
280280

281281
#Pester Testing
282282
task Pester {
283+
$BuildOutputProject = Join-Path $env:BHBuildOutput $env:BHProjectName
284+
$ModuleManifestPath = Join-Path $BuildOutputProject '\*.psd1'
285+
if (-not (Test-Path $ModuleManifestPath)) {throw "Module Manifest not found at $ModuleManifestPath. Did you run 'Invoke-Build Build' first?"}
286+
283287
write-verboseheader "Starting Pester Tests..."
284288
$PesterResultFile = "$($env:BHBuildOutput)\$($env:BHProjectName)-TestResults_PS$PSVersion`_$TimeStamp.xml"
285289

Tests/00-PowershellModule.Tests.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ if (-not (import-module BuildHelpers -PassThru -erroraction silentlycontinue)) {
66
Set-BuildEnvironment -force
77
$PSVersion = $PSVersionTable.PSVersion.Major
88
$BuildOutputProject = Join-Path $env:BHBuildOutput $env:BHProjectName
9+
$ModuleManifestPath = Join-Path $BuildOutputProject '\*.psd1'
10+
11+
if (-not (Test-Path $ModuleManifestPath)) {throw "Module Manifest not found at $ModuleManifestPath. Did you run 'Invoke-Build Build' first?"}
12+
913
Describe 'Powershell Module' {
10-
$ModuleManifestPath = Join-Path $BuildOutputProject '\*.psd1'
14+
1115
Context "$env:BHProjectName" {
1216
$ModuleName = $env:BHProjectName
1317
It 'Has a valid Module Manifest' {

Tests/PowerHTML.Tests.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ if ((get-item .).Name -match 'Tests') {Set-Location $PSScriptRoot\..}
44
$ModuleName = 'PowerHTML'
55
$ModuleManifestName = "$ModuleName.psd1"
66
$ModuleManifestPath = "$PSScriptRoot\..\$ModuleManifestName"
7-
87
Describe 'HTML Basic Conversion' {
98
$HTMLString = @"
109
<!DOCTYPE html>

0 commit comments

Comments
 (0)