Skip to content

Commit a3ecfd8

Browse files
authored
Merge pull request microsoft#21305 from Microsoft/fix-dt-runner-ExpectError-handling
DT runner:Fix $ExpectError handling
2 parents 92bde08 + cadd767 commit a3ecfd8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/harness/externalCompileRunner.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,13 @@ function removeExpectedErrors(errors: string, cwd: string): string {
131131
function isUnexpectedError(cwd: string) {
132132
return (error: string[]) => {
133133
ts.Debug.assertGreaterThanOrEqual(error.length, 1);
134-
const match = error[0].match(/(.+\.ts)\((\d+),\d+\): error TS/);
134+
const match = error[0].match(/(.+\.tsx?)\((\d+),\d+\): error TS/);
135135
if (!match) {
136136
return true;
137137
}
138138
const [, errorFile, lineNumberString] = match;
139139
const lines = fs.readFileSync(path.join(cwd, errorFile), { encoding: "utf8" }).split("\n");
140-
const lineNumber = parseInt(lineNumberString);
140+
const lineNumber = parseInt(lineNumberString) - 1;
141141
ts.Debug.assertGreaterThanOrEqual(lineNumber, 0);
142142
ts.Debug.assertLessThan(lineNumber, lines.length);
143143
const previousLine = lineNumber - 1 > 0 ? lines[lineNumber - 1] : "";

0 commit comments

Comments
 (0)