testdriverai 4.0.78 → 4.0.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/logger.js +13 -10
- package/package.json +1 -1
package/lib/logger.js
CHANGED
|
@@ -33,20 +33,18 @@ marked.use(
|
|
|
33
33
|
const spaceChar = " ";
|
|
34
34
|
|
|
35
35
|
const markedParsePartial = (markdown, start = 0, end = 0) => {
|
|
36
|
-
let result =
|
|
37
|
-
.parse(markdown)
|
|
38
|
-
.replace(/^/gm, spaceChar)
|
|
39
|
-
.trimEnd()
|
|
40
|
-
.split("\n");
|
|
41
|
-
|
|
36
|
+
let result = markdown.trimEnd().split("\n").slice(start, end);
|
|
42
37
|
if (end <= 0) {
|
|
43
38
|
end = result.length + end;
|
|
44
39
|
}
|
|
45
|
-
|
|
40
|
+
result = result.join("\n");
|
|
41
|
+
|
|
42
|
+
return marked.parse(result).replace(/^/gm, spaceChar).trimEnd();
|
|
46
43
|
};
|
|
47
44
|
|
|
48
45
|
const createMarkdownStreamLogger = () => {
|
|
49
46
|
let buffer = "";
|
|
47
|
+
console.log("");
|
|
50
48
|
return {
|
|
51
49
|
log: (chunk) => {
|
|
52
50
|
if (typeof chunk !== "string") {
|
|
@@ -61,14 +59,19 @@ const createMarkdownStreamLogger = () => {
|
|
|
61
59
|
|
|
62
60
|
const consoleOutput = markedParsePartial(buffer, 0, -1);
|
|
63
61
|
|
|
64
|
-
|
|
62
|
+
const diff = consoleOutput.replace(previousConsoleOutput, "");
|
|
63
|
+
if (diff) {
|
|
64
|
+
process.stdout.write(diff);
|
|
65
|
+
}
|
|
65
66
|
},
|
|
66
67
|
end() {
|
|
67
68
|
const previousConsoleOutput = markedParsePartial(buffer, 0, -1);
|
|
68
69
|
|
|
69
70
|
const consoleOutput = markedParsePartial(buffer);
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
const diff = consoleOutput.replace(previousConsoleOutput, "");
|
|
72
|
+
if (diff) {
|
|
73
|
+
process.stdout.write(diff);
|
|
74
|
+
}
|
|
72
75
|
process.stdout.write("\n\n");
|
|
73
76
|
buffer = "";
|
|
74
77
|
log("silly", consoleOutput);
|