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.
Files changed (2) hide show
  1. package/lib/logger.js +13 -10
  2. 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 = marked
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
- return result.slice(start, end).join("\n");
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
- process.stdout.write(consoleOutput.replace(previousConsoleOutput, ""));
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
- process.stdout.write(consoleOutput.replace(previousConsoleOutput, ""));
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "4.0.78",
3
+ "version": "4.0.79",
4
4
  "description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
5
5
  "main": "index.js",
6
6
  "bin": {