check error early and return null to indicate that everything is going well

This commit is contained in:
Kanchalai Tanglertsampan 2017-06-29 16:53:37 -07:00
parent 51fb7e9a81
commit 0ffbb75503

View file

@ -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() +