-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add regression tests for build.psd1 parameters
- Loading branch information
Showing
10 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#requires -Module ModuleBuilder | ||
. $PSScriptRoot\..\Convert-FolderSeparator.ps1 | ||
|
||
Describe "Parameters.Set in build manifest" -Tag Integration { | ||
BeforeAll { | ||
New-Item $PSScriptRoot\Result3\Parameters\ReadMe.md -ItemType File -Force | ||
$Output = Build-Module $PSScriptRoot\Parameters\build.psd1 | ||
if ($Output) { | ||
$Module = [IO.Path]::ChangeExtension($Output.Path, "psm1") | ||
$Metadata = Import-Metadata $Output.Path | ||
} | ||
} | ||
|
||
It "Passthru works" { | ||
$Output | Should -Not -BeNullOrEmpty | ||
} | ||
|
||
It "The Target is Build" { | ||
"$PSScriptRoot\Result3\Parameters\ReadMe.md" | Should -Exist | ||
} | ||
|
||
It "The version is set" { | ||
$Metadata.ModuleVersion | Should -Be "3.0.0" | ||
} | ||
|
||
It "The PreRelease is set" { | ||
$Metadata.PrivateData.PSData.Prerelease | Should -Be 'alpha001' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
@{ | ||
# The module version should be SemVer.org compatible | ||
ModuleVersion = "1.0.0" | ||
|
||
# PrivateData is where all third-party metadata goes | ||
PrivateData = @{ | ||
# PrivateData.PSData is the PowerShell Gallery data | ||
PSData = @{ | ||
# Prerelease string should be here, so we can set it | ||
Prerelease = '' | ||
|
||
# Release Notes have to be here, so we can update them | ||
ReleaseNotes = ' | ||
A test module | ||
' | ||
|
||
# Tags applied to this module. These help with module discovery in online galleries. | ||
Tags = 'Authoring','Build','Development','BestPractices' | ||
|
||
# A URL to the license for this module. | ||
LicenseUri = 'https://github.com/PoshCode/ModuleBuilder/blob/master/LICENSE' | ||
|
||
# A URL to the main website for this project. | ||
ProjectUri = 'https://github.com/PoshCode/ModuleBuilder' | ||
|
||
# A URL to an icon representing this module. | ||
IconUri = 'https://github.com/PoshCode/ModuleBuilder/blob/resources/ModuleBuilder.png?raw=true' | ||
} # End of PSData | ||
} # End of PrivateData | ||
|
||
# The main script module that is automatically loaded as part of this module | ||
RootModule = 'Parameters.psm1' | ||
|
||
# Modules that must be imported into the global environment prior to importing this module | ||
RequiredModules = @() | ||
|
||
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. | ||
DefaultCommandPrefix = 'Param' | ||
|
||
# Always define FunctionsToExport as an empty @() which will be replaced on build | ||
FunctionsToExport = @() | ||
AliasesToExport = @() | ||
|
||
# ID used to uniquely identify this module | ||
GUID = 'a264e183-e0f7-4219-bc80-c30d14e0e98e' | ||
Description = 'A module for authoring and building PowerShell modules' | ||
|
||
# Common stuff for all our modules: | ||
CompanyName = 'PoshCode' | ||
Author = 'Joel Bennett' | ||
Copyright = "Copyright 2024 Joel Bennett" | ||
|
||
# Minimum version of the Windows PowerShell engine required by this module | ||
PowerShellVersion = '5.1' | ||
CompatiblePSEditions = @('Core','Desktop') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
using module ModuleBuilder | ||
|
||
function GetFinale { | ||
[CmdletBinding()] | ||
# [Alias("gf")] | ||
param() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
New-Alias -Name 'Get-MyAlias' -Value 'Get-ChildItem' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
using module ModuleBuilder | ||
|
||
function GetPreview { | ||
[CmdletBinding()] | ||
# [Alias("gp")] | ||
param() | ||
} |
13 changes: 13 additions & 0 deletions
13
Tests/Integration/Parameters/Private/TestUnExportedAliases.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
function TestUnExportedAliases { | ||
[CmdletBinding()] | ||
param() | ||
|
||
New-Alias -Name 'New-NotExportedAlias1' -Value 'Write-Verbose' | ||
Set-Alias -Name 'New-NotExportedAlias2' -Value 'Write-Verbose' | ||
} | ||
|
||
New-Alias -Name 'New-NotExportedAlias3' -Value 'Write-Verbose' -Scope Global | ||
Set-Alias -Name 'New-NotExportedAlias4' -Value 'Write-Verbose' -Scope Global | ||
|
||
New-Alias -Name 'New-NotExportedAlias5' -Value 'Write-Verbose' | ||
Remove-Alias -Name 'New-NotExportedAlias5' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
using module ModuleBuilder | ||
|
||
function Get-Source { | ||
[CmdletBinding()] | ||
[Alias("gs","gsou")] | ||
param() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
function Set-Source { | ||
[CmdletBinding()] | ||
[Alias("ss", "ssou")] | ||
param() | ||
"sto͞o′pĭd" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@{ | ||
Path = "Parameters.psd1" | ||
OutputDirectory = "..\Result3" | ||
SemVer = "3.0.0-alpha001" | ||
Target = "Build" | ||
Passthru = $true | ||
} |
Empty file.