We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6c907b6 commit 310090eCopy full SHA for 310090e
1 file changed
apps/cli/src/legacy/cli/agent-output.e2e.test.ts
@@ -1,8 +1,29 @@
1
import { describe, expect, test } from "vitest";
2
import { runSupabase } from "../../../tests/helpers/cli.ts";
3
4
+function stripAnsi(output: string): string {
5
+ let stripped = "";
6
+ for (let i = 0; i < output.length; i++) {
7
+ const charCode = output.charCodeAt(i);
8
+ if (charCode !== 0x1b || output[i + 1] !== "[") {
9
+ stripped += output[i];
10
+ continue;
11
+ }
12
+
13
+ i += 2;
14
+ while (i < output.length) {
15
+ const code = output.charCodeAt(i);
16
+ if (code >= 0x40 && code <= 0x7e) {
17
+ break;
18
19
+ i++;
20
21
22
+ return stripped;
23
+}
24
25
function parseJsonLines(output: string): Array<unknown> {
- return output
26
+ return stripAnsi(output)
27
.trim()
28
.split("\n")
29
.filter((line) => line.length > 0)
0 commit comments