@@ -21,95 +21,103 @@ describe("UpdatePowerShell feature", function () {
21
21
process . env . POWERSHELL_UPDATECHECK = currentUpdateSetting ;
22
22
} ) ;
23
23
24
- describe ( "When it should check for an update" , function ( ) {
25
- it ( "Won't check if 'promptToUpdatePowerShell' is false" , function ( ) {
26
- settings . promptToUpdatePowerShell = false ;
27
- process . env . POWERSHELL_UPDATECHECK = "Default" ;
28
- const version : IPowerShellVersionDetails = {
29
- "version" : "7.3.0" ,
30
- "displayVersion" : "7.3" ,
31
- "edition" : "Core" ,
32
- "architecture" : "X64"
33
- } ;
34
- // @ts -expect-error testing doesn't require all arguments.
35
- const updater = new UpdatePowerShell ( undefined , settings , testLogger , version ) ;
36
- // @ts -expect-error method is private.
37
- assert ( ! updater . shouldCheckForUpdate ( ) ) ;
38
- } ) ;
24
+ it ( "Won't check if 'promptToUpdatePowerShell' is false" , function ( ) {
25
+ settings . promptToUpdatePowerShell = false ;
26
+ process . env . POWERSHELL_UPDATECHECK = "Default" ;
27
+ const version : IPowerShellVersionDetails = {
28
+ "version" : "7.3.0" ,
29
+ "edition" : "Core" ,
30
+ "commit" : "7.3.0" ,
31
+ "architecture" : "X64"
32
+ } ;
33
+ // @ts -expect-error testing doesn't require all arguments.
34
+ const updater = new UpdatePowerShell ( undefined , settings , testLogger , version ) ;
35
+ // @ts -expect-error method is private.
36
+ assert ( ! updater . shouldCheckForUpdate ( ) ) ;
37
+ } ) ;
38
+
39
+ it ( "Won't check for Windows PowerShell" , function ( ) {
40
+ const version : IPowerShellVersionDetails = {
41
+ "version" : "5.1.22621" ,
42
+ "edition" : "Desktop" ,
43
+ "commit" : "5.1.22621" ,
44
+ "architecture" : "X64"
45
+ } ;
46
+ // @ts -expect-error testing doesn't require all arguments.
47
+ const updater = new UpdatePowerShell ( undefined , settings , testLogger , version ) ;
48
+ // @ts -expect-error method is private.
49
+ assert ( ! updater . shouldCheckForUpdate ( ) ) ;
50
+ } ) ;
39
51
40
- it ( "Won't check for Windows PowerShell" , function ( ) {
41
- const version : IPowerShellVersionDetails = {
42
- // TODO: This should handle e.g. 5.1.22621.436
43
- "version" : "5.1.0" ,
44
- "displayVersion" : "5.1" ,
45
- "edition" : "Desktop" ,
46
- "architecture" : "X64"
47
- } ;
48
- // @ts -expect-error testing doesn't require all arguments.
49
- const updater = new UpdatePowerShell ( undefined , settings , testLogger , version ) ;
50
- // @ts -expect-error method is private.
51
- assert ( ! updater . shouldCheckForUpdate ( ) ) ;
52
- } ) ;
52
+ it ( "Won't check for a development build of PowerShell" , function ( ) {
53
+ const version : IPowerShellVersionDetails = {
54
+ "version" : "7.3.0-preview.3" ,
55
+ "edition" : "Core" ,
56
+ "commit" : "7.3.0-preview.3-508-g07175ae0ff8eb7306fe0b0fc7d19bdef4fbf2d67" ,
57
+ "architecture" : "Arm64"
58
+ } ;
59
+ // @ts -expect-error testing doesn't require all arguments.
60
+ const updater = new UpdatePowerShell ( undefined , settings , testLogger , version ) ;
61
+ // @ts -expect-error method is private.
62
+ assert ( ! updater . shouldCheckForUpdate ( ) ) ;
63
+ } ) ;
53
64
54
- it ( "Won't check if POWERSHELL_UPDATECHECK is 'Off'" , function ( ) {
55
- process . env . POWERSHELL_UPDATECHECK = "Off" ;
56
- const version : IPowerShellVersionDetails = {
57
- "version" : "7.3.0" ,
58
- "displayVersion " : "7.3 " ,
59
- "edition " : "Core " ,
60
- "architecture" : "X64"
61
- } ;
62
- // @ts -expect-error testing doesn't require all arguments.
63
- const updater = new UpdatePowerShell ( undefined , settings , testLogger , version ) ;
64
- // @ts -expect-error method is private.
65
- assert ( ! updater . shouldCheckForUpdate ( ) ) ;
66
- } ) ;
65
+ it ( "Won't check if POWERSHELL_UPDATECHECK is 'Off'" , function ( ) {
66
+ process . env . POWERSHELL_UPDATECHECK = "Off" ;
67
+ const version : IPowerShellVersionDetails = {
68
+ "version" : "7.3.0" ,
69
+ "edition " : "Core " ,
70
+ "commit " : "7.3.0 " ,
71
+ "architecture" : "X64"
72
+ } ;
73
+ // @ts -expect-error testing doesn't require all arguments.
74
+ const updater = new UpdatePowerShell ( undefined , settings , testLogger , version ) ;
75
+ // @ts -expect-error method is private.
76
+ assert ( ! updater . shouldCheckForUpdate ( ) ) ;
77
+ } ) ;
67
78
68
- it ( "Should otherwise check to update PowerShell" , function ( ) {
69
- process . env . POWERSHELL_UPDATECHECK = "Default" ;
70
- const version : IPowerShellVersionDetails = {
71
- "version" : "7.3.0" ,
72
- "displayVersion" : "7.3" ,
73
- "edition" : "Core" ,
74
- "architecture" : "X64"
75
- } ;
76
- // @ts -expect-error testing doesn't require all arguments.
77
- const updater = new UpdatePowerShell ( undefined , settings , testLogger , version ) ;
78
- // @ts -expect-error method is private.
79
- assert ( updater . shouldCheckForUpdate ( ) ) ;
80
- } ) ;
79
+ it ( "Should otherwise check to update PowerShell" , function ( ) {
80
+ process . env . POWERSHELL_UPDATECHECK = "Default" ;
81
+ const version : IPowerShellVersionDetails = {
82
+ "version" : "7.3.0" ,
83
+ "edition" : "Core" ,
84
+ "commit" : "7.3.0" ,
85
+ "architecture" : "X64"
86
+ } ;
87
+ // @ts -expect-error testing doesn't require all arguments.
88
+ const updater = new UpdatePowerShell ( undefined , settings , testLogger , version ) ;
89
+ // @ts -expect-error method is private.
90
+ assert ( updater . shouldCheckForUpdate ( ) ) ;
81
91
} ) ;
82
92
83
- describe ( "Which version it gets" , function ( ) {
84
- it ( "Would update to LTS" , async function ( ) {
85
- process . env . POWERSHELL_UPDATECHECK = "LTS" ;
86
- const version : IPowerShellVersionDetails = {
87
- "version" : "7.0.0" ,
88
- "displayVersion" : "7.0" ,
89
- "edition" : "Core" ,
90
- "architecture" : "X64"
91
- } ;
92
- // @ts -expect-error testing doesn't require all arguments.
93
- const updater = new UpdatePowerShell ( undefined , settings , testLogger , version ) ;
94
- // @ts -expect-error method is private.
95
- const tag : string | undefined = await updater . maybeGetNewRelease ( ) ;
96
- // NOTE: This will need to be updated each new major LTS.
97
- assert ( tag ?. startsWith ( "v7.2" ) ) ;
98
- } ) ;
93
+ it ( "Would update to LTS" , async function ( ) {
94
+ process . env . POWERSHELL_UPDATECHECK = "LTS" ;
95
+ const version : IPowerShellVersionDetails = {
96
+ "version" : "7.0.0" ,
97
+ "edition" : "Core" ,
98
+ "commit" : "7.0.0" ,
99
+ "architecture" : "X64"
100
+ } ;
101
+ // @ts -expect-error testing doesn't require all arguments.
102
+ const updater = new UpdatePowerShell ( undefined , settings , testLogger , version ) ;
103
+ // @ts -expect-error method is private.
104
+ const tag : string | undefined = await updater . maybeGetNewRelease ( ) ;
105
+ // NOTE: This will need to be updated each new major LTS.
106
+ assert ( tag ?. startsWith ( "v7.2" ) ) ;
107
+ } ) ;
99
108
100
- it ( "Would update to stable" , async function ( ) {
101
- const version : IPowerShellVersionDetails = {
102
- "version" : "7.0.0" ,
103
- "displayVersion" : "7.0" ,
104
- "edition" : "Core" ,
105
- "architecture" : "X64"
106
- } ;
107
- // @ts -expect-error testing doesn't require all arguments.
108
- const updater = new UpdatePowerShell ( undefined , settings , testLogger , version ) ;
109
- // @ts -expect-error method is private.
110
- const tag : string | undefined = await updater . maybeGetNewRelease ( ) ;
111
- // NOTE: This will need to be updated each new major stable.
112
- assert ( tag ?. startsWith ( "v7.3" ) ) ;
113
- } ) ;
109
+ it ( "Would update to stable" , async function ( ) {
110
+ const version : IPowerShellVersionDetails = {
111
+ "version" : "7.0.0" ,
112
+ "edition" : "Core" ,
113
+ "commit" : "7.0.0" ,
114
+ "architecture" : "X64"
115
+ } ;
116
+ // @ts -expect-error testing doesn't require all arguments.
117
+ const updater = new UpdatePowerShell ( undefined , settings , testLogger , version ) ;
118
+ // @ts -expect-error method is private.
119
+ const tag : string | undefined = await updater . maybeGetNewRelease ( ) ;
120
+ // NOTE: This will need to be updated each new major stable.
121
+ assert ( tag ?. startsWith ( "v7.3" ) ) ;
114
122
} ) ;
115
123
} ) ;
0 commit comments