@@ -24,7 +24,7 @@ suite("Asset generation: csproj", () => {
2424 let generator = new AssetGenerator ( info , createMockWorkspaceFolder ( rootPath ) ) ;
2525 generator . setStartupProject ( 0 ) ;
2626 let tasksJson = generator . createTasksConfiguration ( ) ;
27- let buildPath = tasksJson . tasks [ 0 ] . args [ 1 ] ;
27+ let buildPath = tasksJson . tasks ! [ 0 ] . args ! [ 1 ] ;
2828
2929 // ${workspaceFolder}/project.json
3030 let segments = buildPath . split ( path . posix . sep ) ;
@@ -39,9 +39,9 @@ suite("Asset generation: csproj", () => {
3939 let tasksJson = generator . createTasksConfiguration ( ) ;
4040
4141 // We do not check the watch task since this parameter can break hot reload scenarios.
42- tasksJson . tasks
42+ tasksJson . tasks !
4343 . filter ( task => task . label !== "watch" )
44- . forEach ( task => task . args . should . contain ( "/property:GenerateFullPaths=true" ) ) ;
44+ . forEach ( task => task . args ! . should . contain ( "/property:GenerateFullPaths=true" ) ) ;
4545 } ) ;
4646
4747 test ( "Generated 'build' and 'publish' tasks have the consoleloggerparameters argument set to NoSummary" , ( ) => {
@@ -52,9 +52,9 @@ suite("Asset generation: csproj", () => {
5252 let tasksJson = generator . createTasksConfiguration ( ) ;
5353
5454 // We do not check the watch task since this parameter can break hot reload scenarios.
55- tasksJson . tasks
55+ tasksJson . tasks !
5656 . filter ( task => task . label !== "watch" )
57- . forEach ( task => task . args . should . contain ( "/consoleloggerparameters:NoSummary" ) ) ;
57+ . forEach ( task => task . args ! . should . contain ( "/consoleloggerparameters:NoSummary" ) ) ;
5858 } ) ;
5959
6060 test ( "Generated 'watch' task does not have the property GenerateFullPaths set to true " , ( ) => {
@@ -64,8 +64,8 @@ suite("Asset generation: csproj", () => {
6464 generator . setStartupProject ( 0 ) ;
6565 let tasksJson = generator . createTasksConfiguration ( ) ;
6666
67- const watchTask = tasksJson . tasks . find ( task => task . label === "watch" ) ;
68- watchTask . args . should . not . contain ( "/property:GenerateFullPaths=true" ) ;
67+ const watchTask = tasksJson . tasks ! . find ( task => task . label === "watch" ) ;
68+ watchTask ! . args ! . should . not . contain ( "/property:GenerateFullPaths=true" ) ;
6969 } ) ;
7070
7171 test ( "Generated 'watch' task does not have the consoleloggerparameters argument set to NoSummary" , ( ) => {
@@ -75,8 +75,8 @@ suite("Asset generation: csproj", () => {
7575 generator . setStartupProject ( 0 ) ;
7676 let tasksJson = generator . createTasksConfiguration ( ) ;
7777
78- const watchTask = tasksJson . tasks . find ( task => task . label === "watch" ) ;
79- watchTask . args . should . not . contain ( "/consoleloggerparameters:NoSummary" ) ;
78+ const watchTask = tasksJson . tasks ! . find ( task => task . label === "watch" ) ;
79+ watchTask ! . args ! . should . not . contain ( "/consoleloggerparameters:NoSummary" ) ;
8080 } ) ;
8181
8282 test ( "Create tasks.json for nested project opened in workspace" , ( ) => {
@@ -85,7 +85,7 @@ suite("Asset generation: csproj", () => {
8585 let generator = new AssetGenerator ( info , createMockWorkspaceFolder ( rootPath ) ) ;
8686 generator . setStartupProject ( 0 ) ;
8787 let tasksJson = generator . createTasksConfiguration ( ) ;
88- let buildPath = tasksJson . tasks [ 0 ] . args [ 1 ] ;
88+ let buildPath = tasksJson . tasks ! [ 0 ] . args ! [ 1 ] ;
8989
9090 // ${workspaceFolder}/nested/project.json
9191 let segments = buildPath . split ( path . posix . sep ) ;
@@ -100,7 +100,7 @@ suite("Asset generation: csproj", () => {
100100 let launchJson = parse ( generator . createLaunchJsonConfigurations ( ProgramLaunchType . Console ) , undefined , { disallowComments : true } ) ;
101101 let programPath : string = launchJson [ 0 ] . program ;
102102
103- checkProgramPath ( rootPath , programPath , info . MsBuild . Projects [ 0 ] . TargetPath ) ;
103+ checkProgramPath ( rootPath , programPath , info . MsBuild ! . Projects [ 0 ] . TargetPath ) ;
104104 } ) ;
105105
106106 [ 5 , 6 , 7 , 8 , 9 ] . forEach ( version => {
@@ -114,7 +114,7 @@ suite("Asset generation: csproj", () => {
114114 let launchJson = parse ( generator . createLaunchJsonConfigurations ( ProgramLaunchType . Console ) , undefined , { disallowComments : true } ) ;
115115 let programPath : string = launchJson [ 0 ] . program ;
116116
117- checkProgramPath ( rootPath , programPath , info . MsBuild . Projects [ 0 ] . TargetPath ) ;
117+ checkProgramPath ( rootPath , programPath , info . MsBuild ! . Projects [ 0 ] . TargetPath ) ;
118118 } ) ;
119119 } ) ;
120120
@@ -126,7 +126,7 @@ suite("Asset generation: csproj", () => {
126126 let launchJson = parse ( generator . createLaunchJsonConfigurations ( ProgramLaunchType . Console ) , undefined , { disallowComments : true } ) ;
127127 let programPath : string = launchJson [ 0 ] . program ;
128128
129- checkProgramPath ( rootPath , programPath , info . MsBuild . Projects [ 0 ] . TargetPath ) ;
129+ checkProgramPath ( rootPath , programPath , info . MsBuild ! . Projects [ 0 ] . TargetPath ) ;
130130 } ) ;
131131
132132 test ( "Create launch.json for project opened in workspace with non-relative output path" , function ( ) {
@@ -142,7 +142,7 @@ suite("Asset generation: csproj", () => {
142142 let launchJson = parse ( generator . createLaunchJsonConfigurations ( ProgramLaunchType . Console ) , undefined , { disallowComments : true } ) ;
143143 let programPath : string = launchJson [ 0 ] . program ;
144144
145- checkProgramPath ( rootPath , programPath , info . MsBuild . Projects [ 0 ] . TargetPath ) ;
145+ checkProgramPath ( rootPath , programPath , info . MsBuild ! . Projects [ 0 ] . TargetPath ) ;
146146 } ) ;
147147
148148 test ( "Create launch.json for Blazor web assembly standalone project opened in workspace" , ( ) => {
@@ -180,7 +180,7 @@ suite("Asset generation: csproj", () => {
180180 const cwd = hostedBlazorLaunchConfig . cwd ;
181181 const hosted = hostedBlazorLaunchConfig . hosted ;
182182
183- checkProgramPath ( rootPath , programPath , info . MsBuild . Projects [ 0 ] . TargetPath ) ;
183+ checkProgramPath ( rootPath , programPath , info . MsBuild ! . Projects [ 0 ] . TargetPath ) ;
184184
185185 cwd . should . equal ( '${workspaceFolder}' ) ;
186186 hosted . should . equal ( true ) ;
@@ -197,7 +197,7 @@ suite("Asset generation: csproj", () => {
197197 const cwd = hostedBlazorLaunchConfig . cwd ;
198198 const hosted = hostedBlazorLaunchConfig . hosted ;
199199
200- checkProgramPath ( rootPath , programPath , info . MsBuild . Projects [ 0 ] . TargetPath ) ;
200+ checkProgramPath ( rootPath , programPath , info . MsBuild ! . Projects [ 0 ] . TargetPath ) ;
201201
202202 cwd . should . equal ( '${workspaceFolder}/nested' ) ;
203203 hosted . should . equal ( true ) ;
@@ -211,7 +211,7 @@ suite("Asset generation: csproj", () => {
211211 let launchJson = parse ( generator . createLaunchJsonConfigurations ( ProgramLaunchType . Web ) , undefined , { disallowComments : true } ) ;
212212 let programPath : string = launchJson [ 0 ] . program ;
213213
214- checkProgramPath ( rootPath , programPath , info . MsBuild . Projects [ 0 ] . TargetPath ) ;
214+ checkProgramPath ( rootPath , programPath , info . MsBuild ! . Projects [ 0 ] . TargetPath ) ;
215215 } ) ;
216216
217217 test ( "Create launch.json for nested web project opened in workspace" , ( ) => {
@@ -222,7 +222,7 @@ suite("Asset generation: csproj", () => {
222222 let launchJson = parse ( generator . createLaunchJsonConfigurations ( ProgramLaunchType . Web ) , undefined , { disallowComments : true } ) ;
223223 let programPath : string = launchJson [ 0 ] . program ;
224224
225- checkProgramPath ( rootPath , programPath , info . MsBuild . Projects [ 0 ] . TargetPath ) ;
225+ checkProgramPath ( rootPath , programPath , info . MsBuild ! . Projects [ 0 ] . TargetPath ) ;
226226 } ) ;
227227
228228 test ( "Add a new item to JSON" , ( ) => {
@@ -234,7 +234,7 @@ suite("Asset generation: csproj", () => {
234234 } ;
235235
236236 const newItem = { name : 'new-item' } ;
237- const updated = updateJsonWithComments ( JSON . stringify ( original ) , [ newItem ] , 'configurations' , 'name' , /*formattingOptions*/ null ) ;
237+ const updated = updateJsonWithComments ( JSON . stringify ( original ) , [ newItem ] , 'configurations' , 'name' , /*formattingOptions*/ null ! ) ;
238238 const parsed = jsonc . parse ( updated ) ;
239239 const configurations = parsed . configurations ;
240240
@@ -254,7 +254,7 @@ suite("Asset generation: csproj", () => {
254254
255255 const updatedItem = { name : 'build' , command : 'dotnet' } ;
256256
257- const updated = updateJsonWithComments ( JSON . stringify ( original ) , [ updatedItem ] , 'configurations' , 'name' , /*formattingOptions*/ null ) ;
257+ const updated = updateJsonWithComments ( JSON . stringify ( original ) , [ updatedItem ] , 'configurations' , 'name' , /*formattingOptions*/ null ! ) ;
258258 const parsed = jsonc . parse ( updated ) ;
259259 const configurations = parsed . configurations ;
260260
@@ -278,7 +278,7 @@ suite("Asset generation: csproj", () => {
278278
279279 const updatedItem = { name : 'build' , command : 'dotnet' } ;
280280
281- const updated = updateJsonWithComments ( original , [ updatedItem ] , 'configurations' , 'name' , /*formattingOptions*/ null ) ;
281+ const updated = updateJsonWithComments ( original , [ updatedItem ] , 'configurations' , 'name' , /*formattingOptions*/ null ! ) ;
282282 const lines = updated . trim ( ) . split ( '\n' ) ;
283283
284284 lines [ 0 ] . trim ( ) . should . equal ( '// user comment in file' ) ;
@@ -336,12 +336,12 @@ function checkProgramPath(rootPath: string, programPath: string, targetPath: str
336336function createMockWorkspaceFolder ( rootPath : string ) : vscode . WorkspaceFolder {
337337 return {
338338 uri : vscode . Uri . file ( rootPath ) ,
339- name : undefined ,
340- index : undefined
339+ name : '' ,
340+ index : - 1
341341 } ;
342342}
343343
344- function createMSBuildWorkspaceInformation ( projectPath : string , assemblyName : string , targetFrameworkShortName : string , targetPath : string = undefined , isExe : boolean = true , isWebProject : boolean = false , isBlazorWebAssemblyStandalone : boolean = false , isBlazorWebAssemblyHosted : boolean = false ) : protocol . WorkspaceInformationResponse {
344+ function createMSBuildWorkspaceInformation ( projectPath : string , assemblyName : string , targetFrameworkShortName : string , targetPath : string | undefined = undefined , isExe : boolean = true , isWebProject : boolean = false , isBlazorWebAssemblyStandalone : boolean = false , isBlazorWebAssemblyHosted : boolean = false ) : protocol . WorkspaceInformationResponse {
345345 return {
346346 MsBuild : {
347347 SolutionPath : '' ,
0 commit comments