Skip to content

Commit

Permalink
fix: index of line with error
Browse files Browse the repository at this point in the history
  • Loading branch information
syzzana committed Nov 25, 2023
1 parent ba4ec68 commit 57e2982
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/testResults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,18 +200,11 @@ export const highlightErrorInCode = (codeSnippet: string): string => {
const errorIndicator = lines.find((line) => line.includes("^"));
const indexOfLineWithError = lines.indexOf(lineWithError);
const indexOfErrorIndicator = lines.indexOf(errorIndicator);
lines[indexOfLineWithError] = Color.text(lineWithError).blue().valueOf();
lines[indexOfErrorIndicator] = Color.text(lineWithError).blue().valueOf();
lines[indexOfLineWithError+1] = Color.text(lineWithError).red().valueOf();
lines[indexOfErrorIndicator+1] = Color.text(errorIndicator).red().valueOf();

return lines.join("\n");
}

export const setColorRed = (char: string): string => {
if (char === "^" || char === "<") {
return Color.text(char).red().valueOf();
}
return char;
}
};

export const ansiRegex = new RegExp(
"([\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~])))",
Expand Down

0 comments on commit 57e2982

Please sign in to comment.