You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test("handles ANSI bold and color combinations",()=>{
64
-
constansiString="\x1b[1;31mBOLD RED ERROR:\x1b[0m \x1b[33mWarning message\x1b[0m";
69
+
constansiString=
70
+
"\x1b[1;31mBOLD RED ERROR:\x1b[0m \x1b[33mWarning message\x1b[0m";
65
71
constresult=ansiToPlainText(ansiString);
66
72
expect(result).toBe("BOLD RED ERROR: Warning message");
67
73
});
68
74
69
75
test("handles Python traceback with ANSI codes",()=>{
70
-
constansiString="\x1b[0;36m File \"\x1b[0m\x1b[0;32mtest.py\x1b[0m\x1b[0;36m\", line \x1b[0m\x1b[0;32m1\x1b[0m\x1b[0;36m, in \x1b[0m\x1b[0;35m<module>\x1b[0m\n\x1b[0;31mNameError\x1b[0m: name 'undefined_var' is not defined";
76
+
constansiString=
77
+
"\x1b[0;36m File \"\x1b[0m\x1b[0;32mtest.py\x1b[0m\x1b[0;36m\", line \x1b[0m\x1b[0;32m1\x1b[0m\x1b[0;36m, in \x1b[0m\x1b[0;35m<module>\x1b[0m\n\x1b[0;31mNameError\x1b[0m: name 'undefined_var' is not defined";
71
78
constresult=ansiToPlainText(ansiString);
72
-
expect(result).toBe('File "test.py", line 1, in <module> NameError: name \'undefined_var\' is not defined');
79
+
expect(result).toBe(
80
+
"File \"test.py\", line 1, in <module> NameError: name 'undefined_var' is not defined",
81
+
);
73
82
});
74
83
75
84
test("handles error messages with background colors",()=>{
expect(result).toBe("CRITICAL ERROR System failure detected");
79
89
});
80
90
81
91
test("handles complex stack trace with mixed formatting",()=>{
82
-
constansiString="Traceback (most recent call last):\n \x1b[36mFile \"\x1b[32m/path/to/file.py\x1b[36m\", line \x1b[32m42\x1b[36m, in \x1b[35mfunction_name\x1b[0m\n \x1b[31mraise ValueError(\"Something went wrong\")\x1b[0m\n\x1b[31mValueError\x1b[0m: Something went wrong";
92
+
constansiString=
93
+
'Traceback (most recent call last):\n \x1b[36mFile "\x1b[32m/path/to/file.py\x1b[36m", line \x1b[32m42\x1b[36m, in \x1b[35mfunction_name\x1b[0m\n \x1b[31mraise ValueError("Something went wrong")\x1b[0m\n\x1b[31mValueError\x1b[0m: Something went wrong';
83
94
constresult=ansiToPlainText(ansiString);
84
-
expect(result).toBe('Traceback (most recent call last): File "/path/to/file.py", line 42, in function_name raise ValueError("Something went wrong") ValueError: Something went wrong');
95
+
expect(result).toBe(
96
+
'Traceback (most recent call last): File "/path/to/file.py", line 42, in function_name raise ValueError("Something went wrong") ValueError: Something went wrong',
constansiString="\x1b[31mReferenceError\x1b[0m: \x1b[33mvariable\x1b[0m is not defined\n at \x1b[36mObject.<anonymous>\x1b[0m (\x1b[32m/path/to/script.js\x1b[0m:\x1b[33m5\x1b[0m:\x1b[33m1\x1b[0m)";
120
+
constansiString=
121
+
"\x1b[31mReferenceError\x1b[0m: \x1b[33mvariable\x1b[0m is not defined\n at \x1b[36mObject.<anonymous>\x1b[0m (\x1b[32m/path/to/script.js\x1b[0m:\x1b[33m5\x1b[0m:\x1b[33m1\x1b[0m)";
107
122
constresult=ansiToPlainText(ansiString);
108
-
expect(result).toBe("ReferenceError: variable is not defined at Object.<anonymous> (/path/to/script.js:5:1)");
123
+
expect(result).toBe(
124
+
"ReferenceError: variable is not defined at Object.<anonymous> (/path/to/script.js:5:1)",
125
+
);
109
126
});
110
127
111
128
test("handles Rust panic with ANSI formatting",()=>{
0 commit comments