1.7 KiB
How To Run BicepHelpers.Tests.ps1
BicepHelpers.Tests.ps1
contains examples of using the Deploy-AzBPBicepFeature
and Remove-AzBPBicepFeature
cmdlet.
Pre-Requisites
- Follow the setup instructions
Steps
-
Navigate to BicepHelpers directory:
cd examples\BicepHelpers\
-
Update
BicepHelpers.Tests.ps1
variables to point to your resource group:rg-test
->your-resource-group-name
-
If using a local copy of
BenchPress.Azure
, replaceImport-Module BenchPress.Azure
withImport-Module "../../bin/BenchPress.Azure.psd1"
. Note that the finalAfterAll
step will properly remove the module regardless of which method is chosen to load the module. -
(Optional) Uncomment the
Remove-AzBPBicepFeature
line inBicepHelpers.Tests.ps1
. Warning: this will delete your resource group. -
Run
BicepHelpers.Tests.ps1
:Invoke-Pester -Path .\BicepHelpers.Tests.ps1
-
Success!
Tests completed in 16.45s Tests Passed: 1, Failed: 0, Skipped: 0 NotRun: 0
-
Don't forget to delete any deployed resources that are no longer needed.
-
(Optional) You can also run checks on your bicep file prior to deploying using
Confirm-AzBPBicepFile
. Force a linting error in../ActionGroup/actionGroup.bicep
by hardcoding the location on line 8:location: "global"
-
Execute
Confirm-AzBPBicepFile -BicepFilePath "../ActionGroup/actionGroup.bicep"
in your terminal and receive the following errors:Error no-unused-params: Parameter "location" is declared but never used. [https://aka.ms/bicep/linter/no-unused-params]
-