From 57e29824212fee6f5dc0d46a9d221b72e426fca7 Mon Sep 17 00:00:00 2001 From: syzzana Date: Sat, 25 Nov 2023 15:54:39 +0100 Subject: [PATCH] fix: index of line with error --- src/testResults.ts | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/testResults.ts b/src/testResults.ts index d498810..a9c786f 100644 --- a/src/testResults.ts +++ b/src/testResults.ts @@ -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=><~])))",