Skip to content

Commit

Permalink
Fix build module tests (#1654)
Browse files Browse the repository at this point in the history
  • Loading branch information
clcaldwell authored Apr 21, 2021
1 parent 6e95790 commit 25b6548
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,6 @@ PSCompatibilityCollector/out/

# Folder of build module
out

# Explicitely Include test dir
!/Tests/**
10 changes: 5 additions & 5 deletions BuildModule.tests.ps1 → Tests/Build/BuildModule.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

# these are tests for the build module

import-module -force "./build.psm1"
import-module -force "$PSScriptRoot\..\..\build.psm1"
Describe "Build Module Tests" {
Context "Global.json" {
BeforeAll {
$globalJson = Get-Content (Join-Path $PSScriptRoot global.json) | ConvertFrom-Json
$globalJson = Get-Content (Join-Path "$PSScriptRoot\..\..\" global.json) | ConvertFrom-Json
$expectedVersion = $globalJson.sdk.version
$result = Get-GlobalJsonSdkVersion
}
Expand Down Expand Up @@ -105,7 +105,7 @@ Describe "Build Module Tests" {
Context "Test result functions" {
BeforeAll {
$xmlFile = @'
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<test-results xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="nunit_schema_2.5.xsd" name="Pester" total="2" errors="0" failures="1" not-run="0" inconclusive="0" ignored="0" skipped="0" invalid="0" date="2019-02-19" time="11:36:56">
<environment platform="Darwin" clr-version="Unknown" os-version="18.2.0" cwd="/Users/jimtru/src/github/forks/JamesWTruher/PSScriptAnalyzer" user="jimtru" user-domain="" machine-name="Jims-Mac-mini.guest.corp.microsoft.com" nunit-version="2.5.8.0" />
<culture-info current-culture="en-US" current-uiculture="en-US" />
Expand Down Expand Up @@ -133,8 +133,8 @@ Describe "Build Module Tests" {
'@

$xmlFile | out-file TESTDRIVE:/results.xml
$results = Get-TestResults -logfile TESTDRIVE:/results.xml
$failures = Get-TestFailures -logfile TESTDRIVE:/results.xml
$results = @(Get-TestResults -logfile TESTDRIVE:/results.xml)
$failures = @(Get-TestFailures -logfile TESTDRIVE:/results.xml)
}

It "Get-TestResults finds 2 results" {
Expand Down
2 changes: 1 addition & 1 deletion build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ function Test-ScriptAnalyzer
$testModulePath = Join-Path "${projectRoot}" -ChildPath out
}
$testResultsFile = "'$(Join-Path ${projectRoot} -childPath TestResults.xml)'"
$testScripts = "'${projectRoot}\Tests\Engine','${projectRoot}\Tests\Rules','${projectRoot}\Tests\Documentation'"
$testScripts = "'${projectRoot}\Tests\Build','${projectRoot}\Tests\Engine','${projectRoot}\Tests\Rules','${projectRoot}\Tests\Documentation'"
try {
if ( $major -lt 5 ) {
Rename-Item $script:destinationDir ${testModulePath}
Expand Down

0 comments on commit 25b6548

Please sign in to comment.