From 0ffbb75503f541953fb0a59a1fc81a11ef01ad1b Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Thu, 29 Jun 2017 16:53:37 -0700 Subject: [PATCH] check error early and return null to indicate that everything is going well --- src/harness/rwcRunner.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/harness/rwcRunner.ts b/src/harness/rwcRunner.ts index 128acb1005..9a490d7be8 100644 --- a/src/harness/rwcRunner.ts +++ b/src/harness/rwcRunner.ts @@ -22,8 +22,7 @@ namespace RWC { } function isTsConfigFile(file: { path: string }): boolean { - const tsConfigFileName = "tsconfig.json"; - return file.path.substr(file.path.length - tsConfigFileName.length).toLowerCase() === tsConfigFileName; + return file.path.indexOf("tsconfig") !== -1 && file.path.indexOf("json") !== -1; } export function runRWCTest(jsonPath: string) { @@ -213,12 +212,11 @@ namespace RWC { it("has the expected errors in generated declaration files", () => { if (compilerOptions.declaration && !compilerResult.errors.length) { Harness.Baseline.runBaseline(`${baseName}.dts.errors.txt`, () => { - const declFileCompilationResult = Harness.Compiler.compileDeclarationFiles( - inputFiles, otherFiles, compilerResult, /*harnessSettings*/ undefined, compilerOptions, currentDirectory); - - if (declFileCompilationResult.declResult.errors.length === 0) { + if (compilerResult.errors.length === 0) { return null; } + const declFileCompilationResult = Harness.Compiler.compileDeclarationFiles( + inputFiles, otherFiles, compilerResult, /*harnessSettings*/ undefined, compilerOptions, currentDirectory); return Harness.Compiler.minimalDiagnosticsToString(declFileCompilationResult.declResult.errors) + Harness.IO.newLine() + Harness.IO.newLine() +