From d8667ae323791902006b03440a59bf8ae4a5d7c4 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 8 Jun 2016 13:14:22 -0700 Subject: [PATCH] Fix test helper --- tests/cases/unittests/transpile.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/cases/unittests/transpile.ts b/tests/cases/unittests/transpile.ts index e694f943e1a..8231f3c9745 100644 --- a/tests/cases/unittests/transpile.ts +++ b/tests/cases/unittests/transpile.ts @@ -10,12 +10,16 @@ namespace ts { expectedDiagnosticTexts?: string[]; } - function checkDiagnostics(diagnostics: Diagnostic[], expectedDiagnosticCodes: number[] = [], expectedDiagnosticTexts: string[] = []) { + function checkDiagnostics(diagnostics: Diagnostic[], expectedDiagnosticCodes: number[] = [], expectedDiagnosticTexts?: string[]) { const n = expectedDiagnosticCodes.length; - assert.equal(n, expectedDiagnosticTexts.length); + if (expectedDiagnosticTexts) { + assert.equal(n, expectedDiagnosticTexts.length); + } for (let i = 0; i < n; i++) { assert.equal(expectedDiagnosticCodes[i], diagnostics[i] && diagnostics[i].code, `Could not find expected diagnostic.`); - assert.equal(expectedDiagnosticTexts[i], diagnostics[i] && diagnostics[i].messageText); + if (expectedDiagnosticTexts) { + assert.equal(expectedDiagnosticTexts[i], diagnostics[i] && diagnostics[i].messageText); + } } assert.equal(diagnostics.length, n, "Resuting diagnostics count does not match expected"); }