11# Copyright (c) Microsoft Corporation.
22# Licensed under the MIT License.
33
4+ BeforeDiscovery {
5+ try {
6+ $windowWidth = [Console ]::WindowWidth
7+ } catch {
8+ $consoleUnavailable = $true
9+ }
10+ }
11+
412Describe ' Discover extension tests' {
513 BeforeAll {
614 $oldPath = $env: PATH
@@ -15,15 +23,31 @@ Describe 'Discover extension tests' {
1523 It ' Discover extensions' {
1624 $out = dsc extension list | ConvertFrom-Json
1725 $LASTEXITCODE | Should - Be 0
18- $out.Count | Should - Be 2 - Because ($out | Out-String )
19- $out [0 ].type | Should - Be ' Microsoft.DSC.Extension/Bicep'
20- $out [0 ].version | Should - Be ' 0.1.0'
21- $out [0 ].capabilities | Should - BeExactly @ (' import' )
22- $out [0 ].manifest | Should -Not - BeNullOrEmpty
23- $out [1 ].type | Should - BeExactly ' Test/Discover'
24- $out [1 ].version | Should - BeExactly ' 0.1.0'
25- $out [1 ].capabilities | Should - BeExactly @ (' discover' )
26- $out [1 ].manifest | Should -Not - BeNullOrEmpty
26+ if ($IsWindows ) {
27+ $out.Count | Should - Be 3 - Because ($out | Out-String )
28+ $out [0 ].type | Should - Be ' Microsoft.DSC.Extension/Bicep'
29+ $out [0 ].version | Should - Be ' 0.1.0'
30+ $out [0 ].capabilities | Should - BeExactly @ (' import' )
31+ $out [0 ].manifest | Should -Not - BeNullOrEmpty
32+ $out [1 ].type | Should - Be ' Microsoft.Windows.Appx/Discover'
33+ $out [1 ].version | Should - Be ' 0.1.0'
34+ $out [1 ].capabilities | Should - BeExactly @ (' discover' )
35+ $out [1 ].manifest | Should -Not - BeNullOrEmpty
36+ $out [2 ].type | Should - BeExactly ' Test/Discover'
37+ $out [2 ].version | Should - BeExactly ' 0.1.0'
38+ $out [2 ].capabilities | Should - BeExactly @ (' discover' )
39+ $out [2 ].manifest | Should -Not - BeNullOrEmpty
40+ } else {
41+ $out.Count | Should - Be 2 - Because ($out | Out-String )
42+ $out [0 ].type | Should - Be ' Microsoft.DSC.Extension/Bicep'
43+ $out [0 ].version | Should - Be ' 0.1.0'
44+ $out [0 ].capabilities | Should - BeExactly @ (' import' )
45+ $out [0 ].manifest | Should -Not - BeNullOrEmpty
46+ $out [1 ].type | Should - BeExactly ' Test/Discover'
47+ $out [1 ].version | Should - BeExactly ' 0.1.0'
48+ $out [1 ].capabilities | Should - BeExactly @ (' discover' )
49+ $out [1 ].manifest | Should -Not - BeNullOrEmpty
50+ }
2751 }
2852
2953 It ' Filtering works for extension discovered resources' {
@@ -94,12 +118,12 @@ Describe 'Discover extension tests' {
94118 }
95119 }
96120
97- It ' Table can be not truncated' {
121+ It ' Table can be not truncated' - Skip:( $consoleUnavailable ) {
98122 $output = dsc extension list -- output- format table- no- truncate
99123 $LASTEXITCODE | Should - Be 0
100124 $foundWideLine = $false
101125 foreach ($line in $output ) {
102- if ($line.Length -gt [ Console ]::WindowWidth ) {
126+ if ($line.Length -gt $windowWidth ) {
103127 $foundWideLine = $true
104128 }
105129 }
0 commit comments