Skip to content

Commit d8667ae

Browse files
author
Andy Hanson
committed
Fix test helper
1 parent 1fe8a08 commit d8667ae

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

tests/cases/unittests/transpile.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ namespace ts {
1010
expectedDiagnosticTexts?: string[];
1111
}
1212

13-
function checkDiagnostics(diagnostics: Diagnostic[], expectedDiagnosticCodes: number[] = [], expectedDiagnosticTexts: string[] = []) {
13+
function checkDiagnostics(diagnostics: Diagnostic[], expectedDiagnosticCodes: number[] = [], expectedDiagnosticTexts?: string[]) {
1414
const n = expectedDiagnosticCodes.length;
15-
assert.equal(n, expectedDiagnosticTexts.length);
15+
if (expectedDiagnosticTexts) {
16+
assert.equal(n, expectedDiagnosticTexts.length);
17+
}
1618
for (let i = 0; i < n; i++) {
1719
assert.equal(expectedDiagnosticCodes[i], diagnostics[i] && diagnostics[i].code, `Could not find expected diagnostic.`);
18-
assert.equal(expectedDiagnosticTexts[i], diagnostics[i] && diagnostics[i].messageText);
20+
if (expectedDiagnosticTexts) {
21+
assert.equal(expectedDiagnosticTexts[i], diagnostics[i] && diagnostics[i].messageText);
22+
}
1923
}
2024
assert.equal(diagnostics.length, n, "Resuting diagnostics count does not match expected");
2125
}

0 commit comments

Comments
 (0)