Skip to content

Fix BuildModules tests #1654

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 21, 2021
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
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