@lage-run/reporters 1.2.0 → 1.2.2

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/CHANGELOG.json CHANGED
@@ -2,7 +2,55 @@
2
2
  "name": "@lage-run/reporters",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 25 Apr 2023 02:50:56 GMT",
5
+ "date": "Mon, 08 May 2023 22:26:52 GMT",
6
+ "tag": "@lage-run/reporters_v1.2.2",
7
+ "version": "1.2.2",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "kchau@microsoft.com",
12
+ "package": "@lage-run/reporters",
13
+ "commit": "5a132808f166179bc316a279c9e11a13d3a39103",
14
+ "comment": "Fixed progress reporter"
15
+ },
16
+ {
17
+ "author": "beachball",
18
+ "package": "@lage-run/reporters",
19
+ "comment": "Bump @lage-run/scheduler-types to v0.3.9",
20
+ "commit": "5a132808f166179bc316a279c9e11a13d3a39103"
21
+ },
22
+ {
23
+ "author": "beachball",
24
+ "package": "@lage-run/reporters",
25
+ "comment": "Bump @lage-run/target-graph to v0.8.6",
26
+ "commit": "5a132808f166179bc316a279c9e11a13d3a39103"
27
+ },
28
+ {
29
+ "author": "beachball",
30
+ "package": "@lage-run/reporters",
31
+ "comment": "Bump @lage-run/format-hrtime to v0.1.5",
32
+ "commit": "5a132808f166179bc316a279c9e11a13d3a39103"
33
+ }
34
+ ]
35
+ }
36
+ },
37
+ {
38
+ "date": "Mon, 08 May 2023 16:33:24 GMT",
39
+ "tag": "@lage-run/reporters_v1.2.1",
40
+ "version": "1.2.1",
41
+ "comments": {
42
+ "patch": [
43
+ {
44
+ "author": "kchau@microsoft.com",
45
+ "package": "@lage-run/reporters",
46
+ "commit": "fbe51aa289332ec599ceeace4171dc1f7d2f5377",
47
+ "comment": "reporting \"abort\" status for \"queued\" or \"running\" tasks when abortSignal is received"
48
+ }
49
+ ]
50
+ }
51
+ },
52
+ {
53
+ "date": "Tue, 25 Apr 2023 02:51:19 GMT",
6
54
  "tag": "@lage-run/reporters_v1.2.0",
7
55
  "version": "1.2.0",
8
56
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,31 @@
1
1
  # Change Log - @lage-run/reporters
2
2
 
3
- This log was last generated on Tue, 25 Apr 2023 02:50:56 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 08 May 2023 22:26:52 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.2.2
8
+
9
+ Mon, 08 May 2023 22:26:52 GMT
10
+
11
+ ### Patches
12
+
13
+ - Fixed progress reporter (kchau@microsoft.com)
14
+ - Bump @lage-run/scheduler-types to v0.3.9
15
+ - Bump @lage-run/target-graph to v0.8.6
16
+ - Bump @lage-run/format-hrtime to v0.1.5
17
+
18
+ ## 1.2.1
19
+
20
+ Mon, 08 May 2023 16:33:24 GMT
21
+
22
+ ### Patches
23
+
24
+ - reporting "abort" status for "queued" or "running" tasks when abortSignal is received (kchau@microsoft.com)
25
+
7
26
  ## 1.2.0
8
27
 
9
- Tue, 25 Apr 2023 02:50:56 GMT
28
+ Tue, 25 Apr 2023 02:51:19 GMT
10
29
 
11
30
  ### Minor changes
12
31
 
@@ -4,14 +4,29 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "AdoReporter", {
6
6
  enumerable: true,
7
- get: ()=>AdoReporter
7
+ get: function() {
8
+ return AdoReporter;
9
+ }
8
10
  });
9
- const _formatHrtime = require("@lage-run/format-hrtime");
10
- const _isTargetStatusLogEntryJs = require("./isTargetStatusLogEntry.js");
11
+ const _formathrtime = require("@lage-run/format-hrtime");
12
+ const _isTargetStatusLogEntry = require("./isTargetStatusLogEntry.js");
11
13
  const _logger = require("@lage-run/logger");
12
- const _chalk = /*#__PURE__*/ _interopRequireDefault(require("chalk"));
13
- const _slowestTargetRunsJs = require("./slowestTargetRuns.js");
14
- function _interopRequireDefault(obj) {
14
+ const _chalk = /*#__PURE__*/ _interop_require_default(require("chalk"));
15
+ const _slowestTargetRuns = require("./slowestTargetRuns.js");
16
+ function _define_property(obj, key, value) {
17
+ if (key in obj) {
18
+ Object.defineProperty(obj, key, {
19
+ value: value,
20
+ enumerable: true,
21
+ configurable: true,
22
+ writable: true
23
+ });
24
+ } else {
25
+ obj[key] = value;
26
+ }
27
+ return obj;
28
+ }
29
+ function _interop_require_default(obj) {
15
30
  return obj && obj.__esModule ? obj : {
16
31
  default: obj
17
32
  };
@@ -78,7 +93,7 @@ class AdoReporter {
78
93
  logTargetEntry(entry) {
79
94
  const colorFn = colors[entry.level];
80
95
  const data = entry.data;
81
- if ((0, _isTargetStatusLogEntryJs.isTargetStatusLogEntry)(data)) {
96
+ if ((0, _isTargetStatusLogEntry.isTargetStatusLogEntry)(data)) {
82
97
  const { target , hash , duration } = data;
83
98
  const { packageName , task } = target;
84
99
  const normalizedArgs = this.options.grouped ? normalize(entry.msg) : normalize(getTaskLogPrefix(packageName ?? "<root>", task), entry.msg);
@@ -87,7 +102,7 @@ class AdoReporter {
87
102
  case "running":
88
103
  return this.logStream.write(format(entry.level, normalizedArgs.prefix, colorFn(`${colors.ok("➔")} start ${pkgTask}`)));
89
104
  case "success":
90
- return this.logStream.write(format(entry.level, normalizedArgs.prefix, colorFn(`${colors.ok("✓")} done ${pkgTask} - ${(0, _formatHrtime.formatDuration)((0, _formatHrtime.hrToSeconds)(duration))}`)));
105
+ return this.logStream.write(format(entry.level, normalizedArgs.prefix, colorFn(`${colors.ok("✓")} done ${pkgTask} - ${(0, _formathrtime.formatDuration)((0, _formathrtime.hrToSeconds)(duration))}`)));
91
106
  case "failed":
92
107
  return this.logStream.write(format(entry.level, normalizedArgs.prefix, colorFn(`${colors.error("✖")} fail ${pkgTask}`)));
93
108
  case "skipped":
@@ -112,10 +127,10 @@ class AdoReporter {
112
127
  const { id } = target;
113
128
  this.groupedEntries.set(id, this.groupedEntries.get(id) || []);
114
129
  this.groupedEntries.get(id)?.push(entry);
115
- if ((0, _isTargetStatusLogEntryJs.isTargetStatusLogEntry)(data)) {
130
+ if ((0, _isTargetStatusLogEntry.isTargetStatusLogEntry)(data)) {
116
131
  if (data.status === "success" || data.status === "failed" || data.status === "skipped" || data.status === "aborted") {
117
132
  const { status , duration } = data;
118
- this.logStream.write(`##[group] ${colors.pkg(data.target.packageName ?? "<root>")} ${colors.task(data.target.task)} ${status}${duration ? `, took ${(0, _formatHrtime.formatDuration)((0, _formatHrtime.hrToSeconds)(duration))}` : ""}\n`);
133
+ this.logStream.write(`##[group] ${colors.pkg(data.target.packageName ?? "<root>")} ${colors.task(data.target.task)} ${status}${duration ? `, took ${(0, _formathrtime.formatDuration)((0, _formathrtime.hrToSeconds)(duration))}` : ""}\n`);
119
134
  const entries = this.groupedEntries.get(id);
120
135
  for (const targetEntry of entries){
121
136
  this.logTargetEntry(targetEntry);
@@ -138,13 +153,13 @@ class AdoReporter {
138
153
  };
139
154
  this.logStream.write(_chalk.default.cyanBright(`##[section]Summary\n`));
140
155
  if (targetRuns.size > 0) {
141
- const slowestTargets = (0, _slowestTargetRunsJs.slowestTargetRuns)([
156
+ const slowestTargets = (0, _slowestTargetRuns.slowestTargetRuns)([
142
157
  ...targetRuns.values()
143
158
  ]);
144
159
  for (const wrappedTarget of slowestTargets){
145
160
  const colorFn = statusColorFn[wrappedTarget.status];
146
161
  const target = wrappedTarget.target;
147
- this.logStream.write(format(_logger.LogLevel.info, getTaskLogPrefix(target.packageName || "[GLOBAL]", target.task), colorFn(`${wrappedTarget.status}${wrappedTarget.duration ? `, took ${(0, _formatHrtime.formatDuration)((0, _formatHrtime.hrToSeconds)(wrappedTarget.duration))}` : ""}`)));
162
+ this.logStream.write(format(_logger.LogLevel.info, getTaskLogPrefix(target.packageName || "[GLOBAL]", target.task), colorFn(`${wrappedTarget.status}${wrappedTarget.duration ? `, took ${(0, _formathrtime.formatDuration)((0, _formathrtime.hrToSeconds)(wrappedTarget.duration))}` : ""}`)));
148
163
  }
149
164
  this.logStream.write(`[Tasks Count] success: ${success.length}, skipped: ${skipped.length}, pending: ${pending.length}, aborted: ${aborted.length}\n`);
150
165
  } else {
@@ -170,9 +185,13 @@ class AdoReporter {
170
185
  packagesMessage += "find the error logs above with the prefix '##[error]!'\n";
171
186
  this.logStream.write(packagesMessage);
172
187
  }
173
- this.logStream.write(format(_logger.LogLevel.info, "", `Took a total of ${(0, _formatHrtime.formatDuration)((0, _formatHrtime.hrToSeconds)(duration))} to complete`));
188
+ this.logStream.write(format(_logger.LogLevel.info, "", `Took a total of ${(0, _formathrtime.formatDuration)((0, _formathrtime.hrToSeconds)(duration))} to complete`));
174
189
  }
175
190
  constructor(options){
191
+ _define_property(this, "options", void 0);
192
+ _define_property(this, "logStream", void 0);
193
+ _define_property(this, "logEntries", void 0);
194
+ _define_property(this, "groupedEntries", void 0);
176
195
  this.options = options;
177
196
  this.logStream = process.stdout;
178
197
  this.logEntries = new Map();
@@ -4,12 +4,27 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "ChromeTraceEventsReporter", {
6
6
  enumerable: true,
7
- get: ()=>ChromeTraceEventsReporter
7
+ get: function() {
8
+ return ChromeTraceEventsReporter;
9
+ }
8
10
  });
9
- const _chalk = /*#__PURE__*/ _interopRequireDefault(require("chalk"));
10
- const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
11
- const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
12
- function _interopRequireDefault(obj) {
11
+ const _chalk = /*#__PURE__*/ _interop_require_default(require("chalk"));
12
+ const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
13
+ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
14
+ function _define_property(obj, key, value) {
15
+ if (key in obj) {
16
+ Object.defineProperty(obj, key, {
17
+ value: value,
18
+ enumerable: true,
19
+ configurable: true,
20
+ writable: true
21
+ });
22
+ } else {
23
+ obj[key] = value;
24
+ }
25
+ return obj;
26
+ }
27
+ function _interop_require_default(obj) {
13
28
  return obj && obj.__esModule ? obj : {
14
29
  default: obj
15
30
  };
@@ -59,6 +74,11 @@ class ChromeTraceEventsReporter {
59
74
  this.consoleLogStream.write(_chalk.default.blueBright(`\nProfiler output written to ${_chalk.default.underline(this.outputFile)}, open it with chrome://tracing or edge://tracing\n`));
60
75
  }
61
76
  constructor(options){
77
+ _define_property(this, "options", void 0);
78
+ _define_property(this, "logStream", void 0);
79
+ _define_property(this, "consoleLogStream", void 0);
80
+ _define_property(this, "events", void 0);
81
+ _define_property(this, "outputFile", void 0);
62
82
  this.options = options;
63
83
  this.consoleLogStream = process.stdout;
64
84
  this.events = {
@@ -4,9 +4,24 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "JsonReporter", {
6
6
  enumerable: true,
7
- get: ()=>JsonReporter
7
+ get: function() {
8
+ return JsonReporter;
9
+ }
8
10
  });
9
- const _formatHrtime = require("@lage-run/format-hrtime");
11
+ const _formathrtime = require("@lage-run/format-hrtime");
12
+ function _define_property(obj, key, value) {
13
+ if (key in obj) {
14
+ Object.defineProperty(obj, key, {
15
+ value: value,
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true
19
+ });
20
+ } else {
21
+ obj[key] = value;
22
+ }
23
+ return obj;
24
+ }
10
25
  class JsonReporter {
11
26
  log(entry) {
12
27
  if (entry.data && entry.data.target && entry.data.target.hidden) {
@@ -24,7 +39,7 @@ class JsonReporter {
24
39
  taskStats.push({
25
40
  package: targetRun.target.packageName,
26
41
  task: targetRun.target.task,
27
- duration: (0, _formatHrtime.hrToSeconds)(targetRun.duration),
42
+ duration: (0, _formathrtime.hrToSeconds)(targetRun.duration),
28
43
  status: targetRun.status
29
44
  });
30
45
  }
@@ -33,13 +48,14 @@ class JsonReporter {
33
48
  summary[`${status}Targets`] = targetRunByStatus[status].length;
34
49
  }
35
50
  }
36
- summary.duration = (0, _formatHrtime.hrToSeconds)(duration);
51
+ summary.duration = (0, _formathrtime.hrToSeconds)(duration);
37
52
  summary.taskStats = taskStats;
38
53
  console.log(JSON.stringify({
39
54
  summary
40
55
  }));
41
56
  }
42
57
  constructor(options){
58
+ _define_property(this, "options", void 0);
43
59
  this.options = options;
44
60
  }
45
61
  }
@@ -4,18 +4,33 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "LogReporter", {
6
6
  enumerable: true,
7
- get: ()=>LogReporter
7
+ get: function() {
8
+ return LogReporter;
9
+ }
8
10
  });
9
- const _formatHrtime = require("@lage-run/format-hrtime");
10
- const _isTargetStatusLogEntryJs = require("./isTargetStatusLogEntry.js");
11
+ const _formathrtime = require("@lage-run/format-hrtime");
12
+ const _isTargetStatusLogEntry = require("./isTargetStatusLogEntry.js");
11
13
  const _logger = require("@lage-run/logger");
12
- const _ansiRegex = /*#__PURE__*/ _interopRequireDefault(require("ansi-regex"));
13
- const _chalk = /*#__PURE__*/ _interopRequireDefault(require("chalk"));
14
- const _gradientString = /*#__PURE__*/ _interopRequireDefault(require("gradient-string"));
15
- const _crypto = /*#__PURE__*/ _interopRequireDefault(require("crypto"));
16
- const _formatBytesJs = require("./formatBytes.js");
17
- const _slowestTargetRunsJs = require("./slowestTargetRuns.js");
18
- function _interopRequireDefault(obj) {
14
+ const _ansiregex = /*#__PURE__*/ _interop_require_default(require("ansi-regex"));
15
+ const _chalk = /*#__PURE__*/ _interop_require_default(require("chalk"));
16
+ const _gradientstring = /*#__PURE__*/ _interop_require_default(require("gradient-string"));
17
+ const _crypto = /*#__PURE__*/ _interop_require_default(require("crypto"));
18
+ const _formatBytes = require("./formatBytes.js");
19
+ const _slowestTargetRuns = require("./slowestTargetRuns.js");
20
+ function _define_property(obj, key, value) {
21
+ if (key in obj) {
22
+ Object.defineProperty(obj, key, {
23
+ value: value,
24
+ enumerable: true,
25
+ configurable: true,
26
+ writable: true
27
+ });
28
+ } else {
29
+ obj[key] = value;
30
+ }
31
+ return obj;
32
+ }
33
+ function _interop_require_default(obj) {
19
34
  return obj && obj.__esModule ? obj : {
20
35
  default: obj
21
36
  };
@@ -55,7 +70,7 @@ function getColorForPkg(pkg) {
55
70
  }
56
71
  return pkgColors[pkgNameToIndexInPkgColorArray.get(pkg)];
57
72
  }
58
- const stripAnsiRegex = (0, _ansiRegex.default)();
73
+ const stripAnsiRegex = (0, _ansiregex.default)();
59
74
  function getTaskLogPrefix(pkg, task) {
60
75
  const pkgColor = getColorForPkg(pkg);
61
76
  return `${pkgColor(pkg)} ${colors.task(task)}`;
@@ -126,13 +141,13 @@ class LogReporter {
126
141
  logTargetEntry(entry) {
127
142
  const colorFn = colors[entry.level];
128
143
  const data = entry.data;
129
- if ((0, _isTargetStatusLogEntryJs.isTargetStatusLogEntry)(data)) {
144
+ if ((0, _isTargetStatusLogEntry.isTargetStatusLogEntry)(data)) {
130
145
  const { hash , duration } = data;
131
146
  switch(data.status){
132
147
  case "running":
133
148
  return this.printEntry(entry, colorFn(`${colors.ok("➔")} start`));
134
149
  case "success":
135
- return this.printEntry(entry, colorFn(`${colors.ok("✓")} done - ${(0, _formatHrtime.formatDuration)((0, _formatHrtime.hrToSeconds)(duration))}`));
150
+ return this.printEntry(entry, colorFn(`${colors.ok("✓")} done - ${(0, _formathrtime.formatDuration)((0, _formathrtime.hrToSeconds)(duration))}`));
136
151
  case "failed":
137
152
  return this.printEntry(entry, colorFn(`${colors.error("✖")} fail`));
138
153
  case "skipped":
@@ -150,7 +165,7 @@ class LogReporter {
150
165
  const data = entry.data;
151
166
  const target = data.target;
152
167
  const { id } = target;
153
- if ((0, _isTargetStatusLogEntryJs.isTargetStatusLogEntry)(data) && (data.status === "success" || data.status === "failed" || data.status === "skipped" || data.status === "aborted")) {
168
+ if ((0, _isTargetStatusLogEntry.isTargetStatusLogEntry)(data) && (data.status === "success" || data.status === "failed" || data.status === "skipped" || data.status === "aborted")) {
154
169
  const entries = this.logEntries.get(id);
155
170
  for (const targetEntry of entries){
156
171
  this.logTargetEntry(targetEntry);
@@ -178,7 +193,7 @@ class LogReporter {
178
193
  if (targetRuns.size > 0) {
179
194
  this.print(_chalk.default.cyanBright(`\nSummary`));
180
195
  this.hr();
181
- const slowestTargets = (0, _slowestTargetRunsJs.slowestTargetRuns)([
196
+ const slowestTargets = (0, _slowestTargetRuns.slowestTargetRuns)([
182
197
  ...targetRuns.values()
183
198
  ]);
184
199
  for (const wrappedTarget of slowestTargets){
@@ -188,14 +203,14 @@ class LogReporter {
188
203
  const colorFn = statusColorFn[wrappedTarget.status] ?? _chalk.default.white;
189
204
  const target = wrappedTarget.target;
190
205
  const hasDurations = !!wrappedTarget.duration && !!wrappedTarget.queueTime;
191
- const queueDuration = hasDurations ? (0, _formatHrtime.hrtimeDiff)(wrappedTarget.queueTime, wrappedTarget.startTime) : [
206
+ const queueDuration = hasDurations ? (0, _formathrtime.hrtimeDiff)(wrappedTarget.queueTime, wrappedTarget.startTime) : [
192
207
  0,
193
208
  0
194
209
  ];
195
- this.print(`${getTaskLogPrefix(target.packageName || "<root>", target.task)} ${colorFn(`${wrappedTarget.status === "running" ? "running - incomplete" : wrappedTarget.status}${hasDurations ? `, took ${(0, _formatHrtime.formatDuration)((0, _formatHrtime.hrToSeconds)(wrappedTarget.duration))}, queued for ${(0, _formatHrtime.formatDuration)((0, _formatHrtime.hrToSeconds)(queueDuration))}` : ""}`)}`);
210
+ this.print(`${getTaskLogPrefix(target.packageName || "<root>", target.task)} ${colorFn(`${wrappedTarget.status === "running" ? "running - incomplete" : wrappedTarget.status}${hasDurations ? `, took ${(0, _formathrtime.formatDuration)((0, _formathrtime.hrToSeconds)(wrappedTarget.duration))}, queued for ${(0, _formathrtime.formatDuration)((0, _formathrtime.hrToSeconds)(queueDuration))}` : ""}`)}`);
196
211
  }
197
212
  this.print(`success: ${success.length}, skipped: ${skipped.length}, pending: ${pending.length}, aborted: ${aborted.length}, failed: ${failed.length}`);
198
- this.print(`worker restarts: ${schedulerRunSummary.workerRestarts}, max worker memory usage: ${(0, _formatBytesJs.formatBytes)(schedulerRunSummary.maxWorkerMemoryUsage)}`);
213
+ this.print(`worker restarts: ${schedulerRunSummary.workerRestarts}, max worker memory usage: ${(0, _formatBytes.formatBytes)(schedulerRunSummary.maxWorkerMemoryUsage)}`);
199
214
  } else {
200
215
  this.print("Nothing has been run.");
201
216
  }
@@ -220,17 +235,21 @@ class LogReporter {
220
235
  const allCacheHits = [
221
236
  ...targetRuns.values()
222
237
  ].filter((run)=>!run.target.hidden).length === skipped.length;
223
- const allCacheHitText = allCacheHits ? (0, _gradientString.default)({
238
+ const allCacheHitText = allCacheHits ? (0, _gradientstring.default)({
224
239
  r: 237,
225
240
  g: 178,
226
241
  b: 77
227
242
  }, "cyan")(`All targets skipped!`) : "";
228
- this.print(`Took a total of ${(0, _formatHrtime.formatDuration)((0, _formatHrtime.hrToSeconds)(duration))} to complete. ${allCacheHitText}`);
243
+ this.print(`Took a total of ${(0, _formathrtime.formatDuration)((0, _formathrtime.hrToSeconds)(duration))} to complete. ${allCacheHitText}`);
229
244
  }
230
245
  resetLogEntries() {
231
246
  this.logEntries.clear();
232
247
  }
233
248
  constructor(options){
249
+ _define_property(this, "options", void 0);
250
+ _define_property(this, "logStream", void 0);
251
+ _define_property(this, "logEntries", void 0);
252
+ _define_property(this, "groupedEntries", void 0);
234
253
  this.options = options;
235
254
  this.logStream = process.stdout;
236
255
  this.logEntries = new Map();
@@ -4,17 +4,32 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "ProgressReporter", {
6
6
  enumerable: true,
7
- get: ()=>ProgressReporter
7
+ get: function() {
8
+ return ProgressReporter;
9
+ }
8
10
  });
9
- const _events = /*#__PURE__*/ _interopRequireDefault(require("events"));
11
+ const _events = /*#__PURE__*/ _interop_require_default(require("events"));
10
12
  const _logger = require("@lage-run/logger");
11
- const _taskReporter = require("@ms-cloudpack/task-reporter");
12
- const _gradientString = /*#__PURE__*/ _interopRequireDefault(require("gradient-string"));
13
- const _chalk = /*#__PURE__*/ _interopRequireDefault(require("chalk"));
14
- const _formatHrtime = require("@lage-run/format-hrtime");
15
- const _formatBytesJs = require("./formatBytes.js");
16
- const _slowestTargetRunsJs = require("./slowestTargetRuns.js");
17
- function _interopRequireDefault(obj) {
13
+ const _taskreporter = require("@ms-cloudpack/task-reporter");
14
+ const _gradientstring = /*#__PURE__*/ _interop_require_default(require("gradient-string"));
15
+ const _chalk = /*#__PURE__*/ _interop_require_default(require("chalk"));
16
+ const _formathrtime = require("@lage-run/format-hrtime");
17
+ const _formatBytes = require("./formatBytes.js");
18
+ const _slowestTargetRuns = require("./slowestTargetRuns.js");
19
+ function _define_property(obj, key, value) {
20
+ if (key in obj) {
21
+ Object.defineProperty(obj, key, {
22
+ value: value,
23
+ enumerable: true,
24
+ configurable: true,
25
+ writable: true
26
+ });
27
+ } else {
28
+ obj[key] = value;
29
+ }
30
+ return obj;
31
+ }
32
+ function _interop_require_default(obj) {
18
33
  return obj && obj.__esModule ? obj : {
19
34
  default: obj
20
35
  };
@@ -32,7 +47,7 @@ const colors = {
32
47
  warn: _chalk.default.yellow
33
48
  };
34
49
  function fancy(str) {
35
- return (0, _gradientString.default)({
50
+ return (0, _gradientstring.default)({
36
51
  r: 237,
37
52
  g: 178,
38
53
  b: 77
@@ -40,7 +55,7 @@ function fancy(str) {
40
55
  }
41
56
  class ProgressReporter {
42
57
  createTaskReporter() {
43
- return new _taskReporter.TaskReporter({
58
+ return new _taskreporter.TaskReporter({
44
59
  productName: "lage",
45
60
  version: this.options.version,
46
61
  showCompleted: true,
@@ -115,7 +130,16 @@ class ProgressReporter {
115
130
  }
116
131
  summarize(schedulerRunSummary) {
117
132
  const { targetRuns , targetRunByStatus , duration } = schedulerRunSummary;
118
- const { failed , aborted , skipped , success , pending } = targetRunByStatus;
133
+ const { failed , aborted , skipped , success , pending , running , queued } = targetRunByStatus;
134
+ // If we are printing summary, and there are still some running / queued tasks - report them as aborted
135
+ for (const wrappedTarget of running.concat(queued)){
136
+ const reporterTask = this.tasks.get(wrappedTarget);
137
+ if (reporterTask) {
138
+ reporterTask.complete({
139
+ status: "abort"
140
+ });
141
+ }
142
+ }
119
143
  const statusColorFn = {
120
144
  success: _chalk.default.greenBright,
121
145
  failed: _chalk.default.redBright,
@@ -128,7 +152,7 @@ class ProgressReporter {
128
152
  if (targetRuns.size > 0) {
129
153
  this.print(_chalk.default.cyanBright(`\nSummary`));
130
154
  this.hr();
131
- const slowestTargets = (0, _slowestTargetRunsJs.slowestTargetRuns)([
155
+ const slowestTargets = (0, _slowestTargetRuns.slowestTargetRuns)([
132
156
  ...targetRuns.values()
133
157
  ]);
134
158
  for (const wrappedTarget of slowestTargets){
@@ -138,14 +162,22 @@ class ProgressReporter {
138
162
  const colorFn = statusColorFn[wrappedTarget.status] ?? _chalk.default.white;
139
163
  const target = wrappedTarget.target;
140
164
  const hasDurations = !!wrappedTarget.duration && !!wrappedTarget.queueTime;
141
- const queueDuration = hasDurations ? (0, _formatHrtime.hrtimeDiff)(wrappedTarget.queueTime, wrappedTarget.startTime) : [
165
+ const queueDuration = hasDurations ? (0, _formathrtime.hrtimeDiff)(wrappedTarget.queueTime, wrappedTarget.startTime) : [
142
166
  0,
143
167
  0
144
168
  ];
145
- this.print(`${target.label} ${colorFn(`${wrappedTarget.status === "running" ? "running - incomplete" : wrappedTarget.status}${hasDurations ? `, took ${(0, _formatHrtime.formatDuration)((0, _formatHrtime.hrToSeconds)(wrappedTarget.duration))}, queued for ${(0, _formatHrtime.formatDuration)((0, _formatHrtime.hrToSeconds)(queueDuration))}` : ""}`)}`);
169
+ if (wrappedTarget.status === "running") {
170
+ const reporterTask = this.tasks.get(wrappedTarget.target.id);
171
+ if (reporterTask) {
172
+ reporterTask.complete({
173
+ status: "fail"
174
+ });
175
+ }
176
+ }
177
+ this.print(`${target.label} ${colorFn(`${wrappedTarget.status === "running" ? "running - incomplete" : wrappedTarget.status}${hasDurations ? `, took ${(0, _formathrtime.formatDuration)((0, _formathrtime.hrToSeconds)(wrappedTarget.duration))}, queued for ${(0, _formathrtime.formatDuration)((0, _formathrtime.hrToSeconds)(queueDuration))}` : ""}`)}`);
146
178
  }
147
179
  this.print(`success: ${success.length}, skipped: ${skipped.length}, pending: ${pending.length}, aborted: ${aborted.length}, failed: ${failed.length}`);
148
- this.print(`worker restarts: ${schedulerRunSummary.workerRestarts}, max worker memory usage: ${(0, _formatBytesJs.formatBytes)(schedulerRunSummary.maxWorkerMemoryUsage)}`);
180
+ this.print(`worker restarts: ${schedulerRunSummary.workerRestarts}, max worker memory usage: ${(0, _formatBytes.formatBytes)(schedulerRunSummary.maxWorkerMemoryUsage)}`);
149
181
  } else {
150
182
  this.print("Nothing has been run.");
151
183
  }
@@ -171,12 +203,19 @@ class ProgressReporter {
171
203
  ...targetRuns.values()
172
204
  ].filter((run)=>!run.target.hidden).length === skipped.length;
173
205
  const allCacheHitText = allCacheHits ? fancy(`All targets skipped!`) : "";
174
- this.print(`Took a total of ${(0, _formatHrtime.formatDuration)((0, _formatHrtime.hrToSeconds)(duration))} to complete. ${allCacheHitText}`);
206
+ this.print(`Took a total of ${(0, _formathrtime.formatDuration)((0, _formathrtime.hrToSeconds)(duration))} to complete. ${allCacheHitText}`);
175
207
  }
176
208
  constructor(options = {
177
209
  concurrency: 0,
178
210
  version: "0.0.0"
179
211
  }){
212
+ _define_property(this, "options", void 0);
213
+ _define_property(this, "logStream", void 0);
214
+ _define_property(this, "startTime", void 0);
215
+ _define_property(this, "logEvent", void 0);
216
+ _define_property(this, "logEntries", void 0);
217
+ _define_property(this, "taskReporter", void 0);
218
+ _define_property(this, "tasks", void 0);
180
219
  this.options = options;
181
220
  this.logStream = process.stdout;
182
221
  this.startTime = [
@@ -4,20 +4,35 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "VerboseFileLogReporter", {
6
6
  enumerable: true,
7
- get: ()=>VerboseFileLogReporter
7
+ get: function() {
8
+ return VerboseFileLogReporter;
9
+ }
8
10
  });
9
- const _formatHrtime = require("@lage-run/format-hrtime");
10
- const _isTargetStatusLogEntryJs = require("./isTargetStatusLogEntry.js");
11
+ const _formathrtime = require("@lage-run/format-hrtime");
12
+ const _isTargetStatusLogEntry = require("./isTargetStatusLogEntry.js");
11
13
  const _logger = require("@lage-run/logger");
12
- const _ansiRegex = /*#__PURE__*/ _interopRequireDefault(require("ansi-regex"));
14
+ const _ansiregex = /*#__PURE__*/ _interop_require_default(require("ansi-regex"));
13
15
  const _stream = require("stream");
14
- const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
15
- function _interopRequireDefault(obj) {
16
+ const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
17
+ function _define_property(obj, key, value) {
18
+ if (key in obj) {
19
+ Object.defineProperty(obj, key, {
20
+ value: value,
21
+ enumerable: true,
22
+ configurable: true,
23
+ writable: true
24
+ });
25
+ } else {
26
+ obj[key] = value;
27
+ }
28
+ return obj;
29
+ }
30
+ function _interop_require_default(obj) {
16
31
  return obj && obj.__esModule ? obj : {
17
32
  default: obj
18
33
  };
19
34
  }
20
- const stripAnsiRegex = (0, _ansiRegex.default)();
35
+ const stripAnsiRegex = (0, _ansiregex.default)();
21
36
  function stripAnsi(message) {
22
37
  return message.replace(stripAnsiRegex, "");
23
38
  }
@@ -63,11 +78,11 @@ class VerboseFileLogReporter {
63
78
  }
64
79
  logTargetEntry(entry) {
65
80
  const data = entry.data;
66
- if ((0, _isTargetStatusLogEntryJs.isTargetStatusLogEntry)(data)) {
81
+ if ((0, _isTargetStatusLogEntry.isTargetStatusLogEntry)(data)) {
67
82
  const { hash , duration , status } = data;
68
83
  const statusMessages = {
69
84
  running: "➔ start",
70
- success: `✓ done - ${duration && (0, _formatHrtime.formatDuration)((0, _formatHrtime.hrToSeconds)(duration))}`,
85
+ success: `✓ done - ${duration && (0, _formathrtime.formatDuration)((0, _formathrtime.hrToSeconds)(duration))}`,
71
86
  failed: "✖ fail",
72
87
  skipped: `» skip - ${hash}`,
73
88
  aborted: "- aborted",
@@ -83,6 +98,7 @@ class VerboseFileLogReporter {
83
98
  // No summary needed for VerboseFileLogReporter
84
99
  }
85
100
  constructor(logFile){
101
+ _define_property(this, "fileStream", void 0);
86
102
  // if logFile is falsy (not specified on cli args), this.fileStream just become a "nowhere" stream and this reporter effectively does nothing
87
103
  this.fileStream = logFile ? _fs.default.createWriteStream(logFile) : new _stream.Writable({
88
104
  write () {}
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "formatBytes", {
6
6
  enumerable: true,
7
- get: ()=>formatBytes
7
+ get: function() {
8
+ return formatBytes;
9
+ }
8
10
  });
9
11
  function formatBytes(bytes) {
10
12
  return `${(bytes / 1024 / 1024).toFixed(2)} MB`;
package/lib/index.js CHANGED
@@ -9,16 +9,28 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- AdoReporter: ()=>_adoReporterJs.AdoReporter,
13
- JsonReporter: ()=>_jsonReporterJs.JsonReporter,
14
- LogReporter: ()=>_logReporterJs.LogReporter,
15
- ChromeTraceEventsReporter: ()=>_chromeTraceEventsReporterJs.ChromeTraceEventsReporter,
16
- ProgressReporter: ()=>_progressReporterJs.ProgressReporter,
17
- VerboseFileLogReporter: ()=>_verboseFileLogReporterJs.VerboseFileLogReporter
12
+ AdoReporter: function() {
13
+ return _AdoReporter.AdoReporter;
14
+ },
15
+ JsonReporter: function() {
16
+ return _JsonReporter.JsonReporter;
17
+ },
18
+ LogReporter: function() {
19
+ return _LogReporter.LogReporter;
20
+ },
21
+ ChromeTraceEventsReporter: function() {
22
+ return _ChromeTraceEventsReporter.ChromeTraceEventsReporter;
23
+ },
24
+ ProgressReporter: function() {
25
+ return _ProgressReporter.ProgressReporter;
26
+ },
27
+ VerboseFileLogReporter: function() {
28
+ return _VerboseFileLogReporter.VerboseFileLogReporter;
29
+ }
18
30
  });
19
- const _adoReporterJs = require("./AdoReporter.js");
20
- const _jsonReporterJs = require("./JsonReporter.js");
21
- const _logReporterJs = require("./LogReporter.js");
22
- const _chromeTraceEventsReporterJs = require("./ChromeTraceEventsReporter.js");
23
- const _progressReporterJs = require("./ProgressReporter.js");
24
- const _verboseFileLogReporterJs = require("./VerboseFileLogReporter.js");
31
+ const _AdoReporter = require("./AdoReporter.js");
32
+ const _JsonReporter = require("./JsonReporter.js");
33
+ const _LogReporter = require("./LogReporter.js");
34
+ const _ChromeTraceEventsReporter = require("./ChromeTraceEventsReporter.js");
35
+ const _ProgressReporter = require("./ProgressReporter.js");
36
+ const _VerboseFileLogReporter = require("./VerboseFileLogReporter.js");
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "isTargetStatusLogEntry", {
6
6
  enumerable: true,
7
- get: ()=>isTargetStatusLogEntry
7
+ get: function() {
8
+ return isTargetStatusLogEntry;
9
+ }
8
10
  });
9
11
  function isTargetStatusLogEntry(data) {
10
12
  return data !== undefined && data.target && data.status !== undefined;
@@ -4,9 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "slowestTargetRuns", {
6
6
  enumerable: true,
7
- get: ()=>slowestTargetRuns
7
+ get: function() {
8
+ return slowestTargetRuns;
9
+ }
8
10
  });
9
- const _formatHrtime = require("@lage-run/format-hrtime");
11
+ const _formathrtime = require("@lage-run/format-hrtime");
10
12
  function slowestTargetRuns(targetRuns) {
11
- return targetRuns.sort((a, b)=>parseFloat((0, _formatHrtime.hrToSeconds)((0, _formatHrtime.hrtimeDiff)(a.duration, b.duration)))).filter((run)=>run.status !== "skipped" && !run.target.hidden);
13
+ return targetRuns.sort((a, b)=>parseFloat((0, _formathrtime.hrToSeconds)((0, _formathrtime.hrtimeDiff)(a.duration, b.duration)))).filter((run)=>run.status !== "skipped" && !run.target.hidden);
12
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lage-run/reporters",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Log reporters for Lage",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,9 +18,9 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@lage-run/logger": "^1.3.0",
21
- "@lage-run/scheduler-types": "^0.3.8",
22
- "@lage-run/target-graph": "^0.8.4",
23
- "@lage-run/format-hrtime": "^0.1.4",
21
+ "@lage-run/scheduler-types": "^0.3.9",
22
+ "@lage-run/target-graph": "^0.8.6",
23
+ "@lage-run/format-hrtime": "^0.1.5",
24
24
  "@ms-cloudpack/task-reporter": "^0.3.2",
25
25
  "chalk": "^4.0.0",
26
26
  "ansi-regex": "^5.0.1",