1818 [validateScript (
1919 { Test-Path - Path $_ }
2020 )]
21- $BuildConfig = ' ./build.yaml ' ,
21+ $BuildConfig ,
2222
2323 [Parameter ()]
2424 # A Specific folder to build the artefact into.
@@ -35,22 +35,34 @@ param
3535 [Parameter ()]
3636 $RequiredModulesDirectory = $ (Join-Path ' output' ' RequiredModules' ),
3737
38+ [Parameter ()]
39+ [object []]
40+ $PesterScript ,
41+
3842 # Filter which tags to run when invoking Pester tests
3943 # This is used in the Invoke-Pester.pester.build.ps1 tasks
4044 [Parameter ()]
4145 [string []]
4246 $PesterTag ,
4347
44- [Parameter ()]
45- [string []]
46- $PesterScript ,
47-
4848 # Filter which tags to exclude when invoking Pester tests
4949 # This is used in the Invoke-Pester.pester.build.ps1 tasks
5050 [Parameter ()]
5151 [string []]
5252 $PesterExcludeTag ,
5353
54+ # Filter which tags to run when invoking DSC Resource tests
55+ # This is used in the DscResource.Test.build.ps1 tasks
56+ [Parameter ()]
57+ [string []]
58+ $DscTestTag ,
59+
60+ # Filter which tags to exclude when invoking DSC Resource tests
61+ # This is used in the DscResource.Test.build.ps1 tasks
62+ [Parameter ()]
63+ [string []]
64+ $DscTestExcludeTag ,
65+
5466 [Parameter ()]
5567 [Alias (' bootstrap' )]
5668 [switch ]$ResolveDependency ,
@@ -210,6 +222,22 @@ process
210222
211223Begin
212224{
225+ # Find build config if not specified
226+ if (-not $BuildConfig ) {
227+ $config = Get-ChildItem - Path " $PSScriptRoot \*" - Include ' build.y*ml' , ' build.psd1' , ' build.json*' - ErrorAction:Ignore
228+ if (-not $config -or ($config -is [array ] -and $config.Length -le 0 )) {
229+ throw " No build configuration found. Specify path via -BuildConfig"
230+ }
231+ elseif ($config -is [array ]) {
232+ if ($config.Length -gt 1 ) {
233+ throw " More than one build configuration found. Specify which one to use via -BuildConfig"
234+ }
235+ $BuildConfig = $config [0 ]
236+ }
237+ else {
238+ $BuildConfig = $config
239+ }
240+ }
213241 # Bootstrapping the environment before using Invoke-Build as task runner
214242
215243 if ($MyInvocation.ScriptName -notLike ' *Invoke-Build.ps1' )
@@ -308,7 +336,7 @@ Begin
308336 # If BuildConfig is a Yaml file, bootstrap powershell-yaml via ResolveDependency
309337 if ($BuildConfig -match ' \.[yaml|yml]$' )
310338 {
311- $ResolveDependencyParams.add (' WithYaml' , $true )
339+ $ResolveDependencyParams.add (' WithYaml' , $True )
312340 }
313341
314342 $ResolveDependencyAvailableParams = (Get-Command - Name ' .\Resolve-Dependency.ps1' ).parameters.keys
0 commit comments