Skip to content

Commit 0ffbb75

Browse files
author
Kanchalai Tanglertsampan
committed
check error early and return null to indicate that everything is going well
1 parent 51fb7e9 commit 0ffbb75

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/harness/rwcRunner.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ namespace RWC {
2222
}
2323

2424
function isTsConfigFile(file: { path: string }): boolean {
25-
const tsConfigFileName = "tsconfig.json";
26-
return file.path.substr(file.path.length - tsConfigFileName.length).toLowerCase() === tsConfigFileName;
25+
return file.path.indexOf("tsconfig") !== -1 && file.path.indexOf("json") !== -1;
2726
}
2827

2928
export function runRWCTest(jsonPath: string) {
@@ -213,12 +212,11 @@ namespace RWC {
213212
it("has the expected errors in generated declaration files", () => {
214213
if (compilerOptions.declaration && !compilerResult.errors.length) {
215214
Harness.Baseline.runBaseline(`${baseName}.dts.errors.txt`, () => {
216-
const declFileCompilationResult = Harness.Compiler.compileDeclarationFiles(
217-
inputFiles, otherFiles, compilerResult, /*harnessSettings*/ undefined, compilerOptions, currentDirectory);
218-
219-
if (declFileCompilationResult.declResult.errors.length === 0) {
215+
if (compilerResult.errors.length === 0) {
220216
return null;
221217
}
218+
const declFileCompilationResult = Harness.Compiler.compileDeclarationFiles(
219+
inputFiles, otherFiles, compilerResult, /*harnessSettings*/ undefined, compilerOptions, currentDirectory);
222220

223221
return Harness.Compiler.minimalDiagnosticsToString(declFileCompilationResult.declResult.errors) +
224222
Harness.IO.newLine() + Harness.IO.newLine() +

0 commit comments

Comments
 (0)