1
1
# Copyright (c) Microsoft Corporation.
2
2
# Licensed under the MIT License.
3
3
4
+ BeforeDiscovery {
5
+ try {
6
+ $windowWidth = [Console ]::WindowWidth
7
+ } catch {
8
+ $consoleUnavailable = $true
9
+ }
10
+ }
11
+
4
12
Describe ' Discover extension tests' {
5
13
BeforeAll {
6
14
$oldPath = $env: PATH
@@ -15,15 +23,31 @@ Describe 'Discover extension tests' {
15
23
It ' Discover extensions' {
16
24
$out = dsc extension list | ConvertFrom-Json
17
25
$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
+ }
27
51
}
28
52
29
53
It ' Filtering works for extension discovered resources' {
@@ -94,12 +118,12 @@ Describe 'Discover extension tests' {
94
118
}
95
119
}
96
120
97
- It ' Table can be not truncated' {
121
+ It ' Table can be not truncated' - Skip:( $consoleUnavailable ) {
98
122
$output = dsc extension list -- output- format table- no- truncate
99
123
$LASTEXITCODE | Should - Be 0
100
124
$foundWideLine = $false
101
125
foreach ($line in $output ) {
102
- if ($line.Length -gt [ Console ]::WindowWidth ) {
126
+ if ($line.Length -gt $windowWidth ) {
103
127
$foundWideLine = $true
104
128
}
105
129
}
0 commit comments