3
3
4
4
BeforeDiscovery {
5
5
$foundBicep = if ($null -ne (Get-Command bicep - ErrorAction Ignore)) {
6
+
6
7
$true
7
8
} else {
8
9
$false
@@ -12,7 +13,6 @@ BeforeDiscovery {
12
13
Describe ' Bicep extension tests' - Skip:(! $foundBicep ) {
13
14
It ' Example bicep file should work' {
14
15
$bicepFile = Resolve-Path - Path " $PSScriptRoot \..\..\dsc\examples\hello_world.dsc.bicep"
15
- Write-Verbose - Verbose (bicep - v)
16
16
$out = dsc - l trace config get -f $bicepFile 2> $TestDrive / error.log | ConvertFrom-Json
17
17
$LASTEXITCODE | Should - Be 0 - Because (Get-Content - Path $TestDrive / error.log - Raw | Out-String )
18
18
$out.results [0 ].result.actualState.output | Should - BeExactly ' Hello, world!'
@@ -22,15 +22,17 @@ Describe 'Bicep extension tests' -Skip:(!$foundBicep) {
22
22
It ' Invalid bicep file returns error' {
23
23
$bicepFile = " $TestDrive /invalid.bicep"
24
24
Set-Content - Path $bicepFile - Value @"
25
- myresource invalid 'Microsoft.DSC.Extension/Bicep:1.0' = {
26
- name: 'invalid'
27
- properties: {
28
- output: 'This is invalid'
25
+ targetScope = 'invalidScope'
26
+
27
+ resource invalid 'Microsoft.DSC.Extension/Bicep:1.0' = {
28
+ name: 'invalid'
29
+ properties: {
30
+ output: 'This is invalid'
29
31
"@
30
32
$out = dsc - l trace config get -f $bicepFile 2> $TestDrive / error.log | ConvertFrom-Json
31
33
$LASTEXITCODE | Should - Be 4 - Because (Get-Content - Path $TestDrive / error.log - Raw | Out-String )
32
34
$content = (Get-Content - Path $TestDrive / error.log - Raw)
33
35
$content | Should -Match " Importing file '$bicepFile ' with extension 'Microsoft.DSC.Extension/Bicep'"
34
- $content | Should -Match " BCP279: Expected a type at this location "
36
+ $content | Should -Match " BCP033 "
35
37
}
36
38
}
0 commit comments