Last active
November 2, 2018 21:31
-
-
Save Splaxi/2a24fc3c5193089ae7047ac5b8f104db to your computer and use it in GitHub Desktop.
Generate pester tests for parametersets
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
$moduleName = "d365fo.tools" | |
#$path = "C:\GIT\GITHUB\$moduleName.Workspace\$moduleName\$moduleName" | |
$path = "C:\GITHUB\LocalRepository\$moduleName" | |
Import-Module $path -Force | |
$excludeCommands = @() | |
$commandsRaw = Get-Command -Module $moduleName | |
if ($excludeCommands.Count -gt 0) { | |
$commands = $commandsRaw | Select-String -Pattern $excludeCommands -SimpleMatch -NotMatch | |
} else { | |
$commands = $commandsRaw | |
} | |
foreach ( $commandName in $commands) { | |
Invoke-PSMDTemplate CommandTest -OutPath "$path\tests\functions" -Name $commandName -Force | |
} | |
Get-ChildItem -Path "$path\tests\functions" -Recurse -File | Set-PSMDEncoding |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment