Skip to content

Commit c9ebec1

Browse files
committed
fix: add null checks to integration test to fix TypeScript errors
1 parent 75c6dfe commit c9ebec1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

apps/vscode-e2e/src/suite/diagnostics.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const num: number = "string"
8383

8484
assert.ok(problemMessages.length > 0, "Should have workspace diagnostics message")
8585

86-
const diagnosticsContent = problemMessages[0].text
86+
const diagnosticsContent = problemMessages[0]?.text
8787
assert.ok(
8888
!diagnosticsContent?.includes("Type 'string' is not assignable to type 'number'") &&
8989
!diagnosticsContent?.includes("unusedVar") &&
@@ -145,7 +145,7 @@ const num: number = "string"
145145

146146
assert.ok(problemMessages.length > 0, "Should have workspace diagnostics message")
147147

148-
const diagnosticsContent = problemMessages[0].text || ""
148+
const diagnosticsContent = problemMessages[0]?.text || ""
149149

150150
// Count the number of diagnostic entries
151151
const diagnosticMatches = diagnosticsContent.match(/error\d+:/g) || []
@@ -209,7 +209,7 @@ const num: number = "string"
209209

210210
assert.ok(problemMessages.length > 0, "Should have workspace diagnostics message")
211211

212-
const diagnosticsContent = problemMessages[0].text || ""
212+
const diagnosticsContent = problemMessages[0]?.text || ""
213213

214214
// Should include diagnostics from all 3 files
215215
for (let i = 0; i < 3; i++) {
@@ -259,7 +259,7 @@ const num: number = "string"
259259

260260
assert.ok(problemMessages.length > 0, "Should have workspace diagnostics message")
261261

262-
const diagnosticsContent = problemMessages[0].text || ""
262+
const diagnosticsContent = problemMessages[0]?.text || ""
263263

264264
// Default includeDiagnosticMessages is true, so should include details
265265
assert.ok(

0 commit comments

Comments
 (0)