Skip to content
This repository was archived by the owner on Mar 9, 2026. It is now read-only.

Commit 463a4e5

Browse files
committed
Dont publish tests (#15)
* Refactoring Script Validation Tests naming convention Changing the naming convention from .Tests.ps1 to .ScriptValidationTest.ps1 to differentiate unit tests from script validation tests * Don't include Pester unit tests in the build artefact
1 parent f966a50 commit 463a4e5

9 files changed

Lines changed: 7 additions & 7 deletions

OctopusStepTemplateCi.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<copyright>(c) 2016 ASOS, licensed under Apache 2.0 License.</copyright>
1414
</metadata>
1515
<files>
16-
<file src="OctopusStepTemplateCi\**\*.*" target="" />
16+
<file src="OctopusStepTemplateCi\**\*.*" target="" exclude="**\*.Tests.ps1"/>
1717
<file src="LICENSE*" target="" />
1818
</files>
1919
</package>

OctopusStepTemplateCi/Cmdlets/Interface/Invoke-OctopusScriptTestSuite.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,19 @@ function Invoke-OctopusScriptTestSuite {
7272
-SuppressPesterOutput:$SuppressPesterOutput
7373

7474
Invoke-PesterForTeamCity -TestName $_.Name `
75-
-Script @{ Path = (Join-Path (Get-ScriptValidationTestsPath) "\Generic\*.Tests.ps1"); Parameters = @{ sut = $_.FullName; TestResultsFile = $testResultsFile; Settings = $TestSettings } } `
75+
-Script @{ Path = (Join-Path (Get-ScriptValidationTestsPath) "\Generic\*.ScriptValidationTest.ps1"); Parameters = @{ sut = $_.FullName; TestResultsFile = $testResultsFile; Settings = $TestSettings } } `
7676
-TestResultsFile (Join-Path $ResultFilesPath $_.Name.Replace(".ps1", ".generic.TestResults.xml")) `
7777
-SuppressPesterOutput:$SuppressPesterOutput
7878

7979
if ($_.Name -like $ScriptModuleFilter) {
8080
Invoke-PesterForTeamCity -TestName $_.Name `
81-
-Script @{ Path = (Join-Path (Get-ScriptValidationTestsPath) "\ScriptModules\*.Tests.ps1"); Parameters = @{ sut = $_.FullName; TestResultsFile = $testResultsFile; Settings = $TestSettings } } `
81+
-Script @{ Path = (Join-Path (Get-ScriptValidationTestsPath) "\ScriptModules\*.ScriptValidationTest.ps1"); Parameters = @{ sut = $_.FullName; TestResultsFile = $testResultsFile; Settings = $TestSettings } } `
8282
-TestResultsFile (Join-Path $ResultFilesPath $_.Name.Replace(".ps1", ".script-module.TestResults.xml")) `
8383
-SuppressPesterOutput:$SuppressPesterOutput
8484
}
8585
elseif ($_.Name -like $StepTemplateFilter) {
8686
Invoke-PesterForTeamCity -TestName $_.Name `
87-
-Script @{ Path = (Join-Path (Get-ScriptValidationTestsPath) "\StepTemplates\*.Tests.ps1"); Parameters = @{ sut = $_.FullName; TestResultsFile = $testResultsFile; Settings = $TestSettings } } `
87+
-Script @{ Path = (Join-Path (Get-ScriptValidationTestsPath) "\StepTemplates\*.ScriptValidationTest.ps1"); Parameters = @{ sut = $_.FullName; TestResultsFile = $testResultsFile; Settings = $TestSettings } } `
8888
-TestResultsFile (Join-Path $ResultFilesPath $_.Name.Replace(".ps1", ".step-template.TestResults.xml")) `
8989
-SuppressPesterOutput:$SuppressPesterOutput
9090
}

OctopusStepTemplateCi/Cmdlets/Interface/New-ScriptValidationTest.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ $sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.'
2929

3030
Describe "New-ScriptValidationTest" {
3131
It "Should throw an exception if the script validation test exists" {
32-
New-Item "TestDrive:\test.Tests.ps1" -ItemType File | Out-Null
32+
New-Item "TestDrive:\test.ScriptValidationTest.ps1" -ItemType File | Out-Null
3333

3434
{ New-ScriptValidationTest -Name "test" -Path "TestDrive:\" } | Should Throw
3535
}
3636

3737
It "Should create a new script validation test file" {
3838
New-ScriptValidationTest -Name "test1" -Path "TestDrive:\"
3939

40-
"TestDrive:\test1.Tests.ps1" | Should Exist
40+
"TestDrive:\test1.ScriptValidationTest.ps1" | Should Exist
4141
}
4242

4343
It "Should output a message to the user" {

OctopusStepTemplateCi/Cmdlets/Interface/New-ScriptValidationTest.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function New-ScriptValidationTest {
4242
[Parameter(Mandatory=$false)][ValidateScript({ Test-Path $_ })][System.String]$Path = $PWD
4343
)
4444

45-
$fileName = Join-Path $Path ("{0}.Tests.ps1" -f ($Name -replace '\s', '-'))
45+
$fileName = Join-Path $Path ("{0}.ScriptValidationTest.ps1" -f ($Name -replace '\s', '-'))
4646

4747
if (Test-Path $fileName) {
4848
throw "Script Validation Test file '$fileName' already exists"

OctopusStepTemplateCi/ScriptValidationTests/Generic/FileFormat.Tests.ps1 renamed to OctopusStepTemplateCi/ScriptValidationTests/Generic/FileFormat.ScriptValidationTest.ps1

File renamed without changes.

OctopusStepTemplateCi/ScriptValidationTests/Generic/PSScriptAnalyzer.Tests.ps1 renamed to OctopusStepTemplateCi/ScriptValidationTests/Generic/PSScriptAnalyzer.ScriptValidationTest.ps1

File renamed without changes.

OctopusStepTemplateCi/ScriptValidationTests/Generic/TestNaming.Tests.ps1 renamed to OctopusStepTemplateCi/ScriptValidationTests/Generic/TestNaming.ScriptValidationTest.ps1

File renamed without changes.

OctopusStepTemplateCi/ScriptValidationTests/ScriptModules/Parameters.Tests.ps1 renamed to OctopusStepTemplateCi/ScriptValidationTests/ScriptModules/Parameters.ScriptValidationTest.ps1

File renamed without changes.

OctopusStepTemplateCi/ScriptValidationTests/StepTemplates/Parameters.Tests.ps1 renamed to OctopusStepTemplateCi/ScriptValidationTests/StepTemplates/Parameters.ScriptValidationTest.ps1

File renamed without changes.

0 commit comments

Comments
 (0)