@supatest/playwright-reporter 0.0.7 → 0.0.8

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/dist/index.cjs CHANGED
@@ -5,7 +5,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJS = (cb, mod) => function __require() {
8
+ var __commonJS = (cb, mod) => function __require2() {
9
9
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
10
  };
11
11
  var __export = (target, all) => {
@@ -917,25 +917,40 @@ __export(index_exports, {
917
917
  module.exports = __toCommonJS(index_exports);
918
918
  var import_node_fs = __toESM(require("fs"), 1);
919
919
  var import_node_os = __toESM(require("os"), 1);
920
- var import_node_path2 = __toESM(require("path"), 1);
920
+ var import_node_path = __toESM(require("path"), 1);
921
921
 
922
- // ../node_modules/.pnpm/simple-git@3.30.0/node_modules/simple-git/dist/esm/index.js
923
- var import_node_buffer = require("buffer");
922
+ // ../node_modules/.pnpm/simple-git@3.27.0/node_modules/simple-git/dist/esm/index.js
924
923
  var import_file_exists = __toESM(require_dist(), 1);
925
924
  var import_debug = __toESM(require_src(), 1);
926
925
  var import_child_process = require("child_process");
927
926
  var import_promise_deferred = __toESM(require_dist2(), 1);
928
- var import_node_path = require("path");
929
927
  var import_promise_deferred2 = __toESM(require_dist2(), 1);
930
928
  var import_node_events = require("events");
931
929
  var __defProp2 = Object.defineProperty;
930
+ var __defProps = Object.defineProperties;
932
931
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
932
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
933
933
  var __getOwnPropNames2 = Object.getOwnPropertyNames;
934
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
934
935
  var __hasOwnProp2 = Object.prototype.hasOwnProperty;
936
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
937
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
938
+ var __spreadValues = (a, b) => {
939
+ for (var prop in b || (b = {}))
940
+ if (__hasOwnProp2.call(b, prop))
941
+ __defNormalProp(a, prop, b[prop]);
942
+ if (__getOwnPropSymbols)
943
+ for (var prop of __getOwnPropSymbols(b)) {
944
+ if (__propIsEnum.call(b, prop))
945
+ __defNormalProp(a, prop, b[prop]);
946
+ }
947
+ return a;
948
+ };
949
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
935
950
  var __esm = (fn, res) => function __init() {
936
951
  return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
937
952
  };
938
- var __commonJS2 = (cb, mod) => function __require() {
953
+ var __commonJS2 = (cb, mod) => function __require2() {
939
954
  return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
940
955
  };
941
956
  var __export2 = (target, all) => {
@@ -951,6 +966,26 @@ var __copyProps2 = (to, from, except, desc) => {
951
966
  return to;
952
967
  };
953
968
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
969
+ var __async = (__this, __arguments, generator) => {
970
+ return new Promise((resolve, reject) => {
971
+ var fulfilled = (value) => {
972
+ try {
973
+ step(generator.next(value));
974
+ } catch (e) {
975
+ reject(e);
976
+ }
977
+ };
978
+ var rejected = (value) => {
979
+ try {
980
+ step(generator.throw(value));
981
+ } catch (e) {
982
+ reject(e);
983
+ }
984
+ };
985
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
986
+ step((generator = generator.apply(__this, __arguments)).next());
987
+ });
988
+ };
954
989
  function pathspec(...paths) {
955
990
  const key = new String(paths);
956
991
  cache.set(key, paths);
@@ -1008,10 +1043,7 @@ var init_task_configuration_error = __esm({
1008
1043
  }
1009
1044
  });
1010
1045
  function asFunction(source) {
1011
- if (typeof source !== "function") {
1012
- return NOOP;
1013
- }
1014
- return source;
1046
+ return typeof source === "function" ? source : NOOP;
1015
1047
  }
1016
1048
  function isUserFunction(source) {
1017
1049
  return typeof source === "function" && source !== NOOP;
@@ -1032,7 +1064,7 @@ function last(input, offset = 0) {
1032
1064
  }
1033
1065
  }
1034
1066
  function isArrayLike(input) {
1035
- return filterHasLength(input);
1067
+ return !!(input && typeof input.length === "number");
1036
1068
  }
1037
1069
  function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
1038
1070
  return input.split(separator).reduce((output, line) => {
@@ -1085,16 +1117,14 @@ function asCamelCase(str) {
1085
1117
  });
1086
1118
  }
1087
1119
  function asStringArray(source) {
1088
- return asArray(source).map((item) => {
1089
- return item instanceof String ? item : String(item);
1090
- });
1120
+ return asArray(source).map(String);
1091
1121
  }
1092
1122
  function asNumber(source, onNaN = 0) {
1093
1123
  if (source == null) {
1094
1124
  return onNaN;
1095
1125
  }
1096
1126
  const num = parseInt(source, 10);
1097
- return Number.isNaN(num) ? onNaN : num;
1127
+ return isNaN(num) ? onNaN : num;
1098
1128
  }
1099
1129
  function prefixedArray(input, prefix) {
1100
1130
  const output = [];
@@ -1104,16 +1134,13 @@ function prefixedArray(input, prefix) {
1104
1134
  return output;
1105
1135
  }
1106
1136
  function bufferToString(input) {
1107
- return (Array.isArray(input) ? import_node_buffer.Buffer.concat(input) : input).toString("utf-8");
1137
+ return (Array.isArray(input) ? Buffer.concat(input) : input).toString("utf-8");
1108
1138
  }
1109
1139
  function pick(source, properties) {
1110
- const out = {};
1111
- properties.forEach((key) => {
1112
- if (source[key] !== void 0) {
1113
- out[key] = source[key];
1114
- }
1115
- });
1116
- return out;
1140
+ return Object.assign(
1141
+ {},
1142
+ ...properties.map((property) => property in source ? { [property]: source[property] } : {})
1143
+ );
1117
1144
  }
1118
1145
  function delay(duration = 0) {
1119
1146
  return new Promise((done) => setTimeout(done, duration));
@@ -1130,7 +1157,6 @@ var objectToString;
1130
1157
  var init_util = __esm({
1131
1158
  "src/lib/utils/util.ts"() {
1132
1159
  "use strict";
1133
- init_argument_filters();
1134
1160
  NULL = "\0";
1135
1161
  NOOP = () => {
1136
1162
  };
@@ -1154,24 +1180,24 @@ function filterFunction(input) {
1154
1180
  return typeof input === "function";
1155
1181
  }
1156
1182
  var filterArray;
1157
- var filterNumber;
1158
1183
  var filterString;
1184
+ var filterStringArray;
1159
1185
  var filterStringOrStringArray;
1160
1186
  var filterHasLength;
1161
1187
  var init_argument_filters = __esm({
1162
1188
  "src/lib/utils/argument-filters.ts"() {
1163
1189
  "use strict";
1164
- init_pathspec();
1165
1190
  init_util();
1191
+ init_pathspec();
1166
1192
  filterArray = (input) => {
1167
1193
  return Array.isArray(input);
1168
1194
  };
1169
- filterNumber = (input) => {
1170
- return typeof input === "number";
1171
- };
1172
1195
  filterString = (input) => {
1173
1196
  return typeof input === "string";
1174
1197
  };
1198
+ filterStringArray = (input) => {
1199
+ return Array.isArray(input) && input.every(filterString);
1200
+ };
1175
1201
  filterStringOrStringArray = (input) => {
1176
1202
  return filterString(input) || Array.isArray(input) && input.every(filterString);
1177
1203
  };
@@ -1179,7 +1205,7 @@ var init_argument_filters = __esm({
1179
1205
  if (input == null || "number|boolean|function".includes(typeof input)) {
1180
1206
  return false;
1181
1207
  }
1182
- return typeof input.length === "number";
1208
+ return Array.isArray(input) || typeof input === "string" || typeof input.length === "number";
1183
1209
  };
1184
1210
  }
1185
1211
  });
@@ -1200,20 +1226,17 @@ var GitOutputStreams;
1200
1226
  var init_git_output_streams = __esm({
1201
1227
  "src/lib/utils/git-output-streams.ts"() {
1202
1228
  "use strict";
1203
- GitOutputStreams = class _GitOutputStreams {
1229
+ GitOutputStreams = class {
1204
1230
  constructor(stdOut, stdErr) {
1205
1231
  this.stdOut = stdOut;
1206
1232
  this.stdErr = stdErr;
1207
1233
  }
1208
1234
  asStrings() {
1209
- return new _GitOutputStreams(this.stdOut.toString("utf8"), this.stdErr.toString("utf8"));
1235
+ return new GitOutputStreams(this.stdOut.toString("utf8"), this.stdErr.toString("utf8"));
1210
1236
  }
1211
1237
  };
1212
1238
  }
1213
1239
  });
1214
- function useMatchesDefault() {
1215
- throw new Error(`LineParser:useMatches not implemented`);
1216
- }
1217
1240
  var LineParser;
1218
1241
  var RemoteLineParser;
1219
1242
  var init_line_parser = __esm({
@@ -1222,7 +1245,6 @@ var init_line_parser = __esm({
1222
1245
  LineParser = class {
1223
1246
  constructor(regExp, useMatches) {
1224
1247
  this.matches = [];
1225
- this.useMatches = useMatchesDefault;
1226
1248
  this.parse = (line, target) => {
1227
1249
  this.resetMatches();
1228
1250
  if (!this._regExp.every((reg, index) => this.addMatch(reg, index, line(index)))) {
@@ -1235,6 +1257,9 @@ var init_line_parser = __esm({
1235
1257
  this.useMatches = useMatches;
1236
1258
  }
1237
1259
  }
1260
+ useMatches(target, match) {
1261
+ throw new Error(`LineParser:useMatches not implemented`);
1262
+ }
1238
1263
  resetMatches() {
1239
1264
  this.matches.length = 0;
1240
1265
  }
@@ -1267,7 +1292,7 @@ var init_line_parser = __esm({
1267
1292
  function createInstanceConfig(...options) {
1268
1293
  const baseDir = process.cwd();
1269
1294
  const config = Object.assign(
1270
- { baseDir, ...defaultOptions },
1295
+ __spreadValues({ baseDir }, defaultOptions),
1271
1296
  ...options.filter((o) => typeof o === "object" && o)
1272
1297
  );
1273
1298
  config.baseDir = config.baseDir || baseDir;
@@ -1296,12 +1321,6 @@ function appendTaskOptions(options, commands = []) {
1296
1321
  commands2.push(value);
1297
1322
  } else if (filterPrimitives(value, ["boolean"])) {
1298
1323
  commands2.push(key + "=" + value);
1299
- } else if (Array.isArray(value)) {
1300
- for (const v of value) {
1301
- if (!filterPrimitives(v, ["string", "number"])) {
1302
- commands2.push(key + "=" + v);
1303
- }
1304
- }
1305
1324
  } else {
1306
1325
  commands2.push(key);
1307
1326
  }
@@ -1323,7 +1342,7 @@ function getTrailingOptions(args, initialPrimitive = 0, objectOnly = false) {
1323
1342
  }
1324
1343
  function trailingArrayArgument(args) {
1325
1344
  const hasTrailingCallback = typeof last(args) === "function";
1326
- return asStringArray(filterType(last(args, hasTrailingCallback ? 1 : 0), filterArray, []));
1345
+ return filterType(last(args, hasTrailingCallback ? 1 : 0), filterArray, []);
1327
1346
  }
1328
1347
  function trailingOptionsArgument(args) {
1329
1348
  const hasTrailingCallback = filterFunction(last(args));
@@ -1386,10 +1405,10 @@ __export2(utils_exports, {
1386
1405
  filterArray: () => filterArray,
1387
1406
  filterFunction: () => filterFunction,
1388
1407
  filterHasLength: () => filterHasLength,
1389
- filterNumber: () => filterNumber,
1390
1408
  filterPlainObject: () => filterPlainObject,
1391
1409
  filterPrimitives: () => filterPrimitives,
1392
1410
  filterString: () => filterString,
1411
+ filterStringArray: () => filterStringArray,
1393
1412
  filterStringOrStringArray: () => filterStringOrStringArray,
1394
1413
  filterType: () => filterType,
1395
1414
  first: () => first,
@@ -1752,7 +1771,7 @@ var init_ConfigList = __esm({
1752
1771
  }
1753
1772
  addValue(file, key, value) {
1754
1773
  const values = this.addFile(file);
1755
- if (!Object.hasOwn(values, key)) {
1774
+ if (!values.hasOwnProperty(key)) {
1756
1775
  values[key] = value;
1757
1776
  } else if (Array.isArray(values[key])) {
1758
1777
  values[key].push(value);
@@ -1765,7 +1784,7 @@ var init_ConfigList = __esm({
1765
1784
  }
1766
1785
  });
1767
1786
  function asConfigScope(scope, fallback) {
1768
- if (typeof scope === "string" && Object.hasOwn(GitConfigScope, scope)) {
1787
+ if (typeof scope === "string" && GitConfigScope.hasOwnProperty(scope)) {
1769
1788
  return scope;
1770
1789
  }
1771
1790
  return fallback;
@@ -1986,14 +2005,13 @@ function getResetMode(mode) {
1986
2005
  return;
1987
2006
  }
1988
2007
  function isValidResetMode(mode) {
1989
- return typeof mode === "string" && validResetModes.includes(mode);
2008
+ return ResetModes.includes(mode);
1990
2009
  }
1991
2010
  var ResetMode;
1992
- var validResetModes;
2011
+ var ResetModes;
1993
2012
  var init_reset = __esm({
1994
2013
  "src/lib/tasks/reset.ts"() {
1995
2014
  "use strict";
1996
- init_utils();
1997
2015
  init_task();
1998
2016
  ResetMode = /* @__PURE__ */ ((ResetMode2) => {
1999
2017
  ResetMode2["MIXED"] = "mixed";
@@ -2003,7 +2021,7 @@ var init_reset = __esm({
2003
2021
  ResetMode2["KEEP"] = "keep";
2004
2022
  return ResetMode2;
2005
2023
  })(ResetMode || {});
2006
- validResetModes = asStringArray(Object.values(ResetMode));
2024
+ ResetModes = Array.from(Object.values(ResetMode));
2007
2025
  }
2008
2026
  });
2009
2027
  function createLog() {
@@ -2070,13 +2088,14 @@ var init_git_logger = __esm({
2070
2088
  };
2071
2089
  }
2072
2090
  });
2091
+ var _TasksPendingQueue;
2073
2092
  var TasksPendingQueue;
2074
2093
  var init_tasks_pending_queue = __esm({
2075
2094
  "src/lib/runners/tasks-pending-queue.ts"() {
2076
2095
  "use strict";
2077
2096
  init_git_error();
2078
2097
  init_git_logger();
2079
- TasksPendingQueue = class _TasksPendingQueue {
2098
+ _TasksPendingQueue = class {
2080
2099
  constructor(logLabel = "GitExecutor") {
2081
2100
  this.logLabel = logLabel;
2082
2101
  this._queue = /* @__PURE__ */ new Map();
@@ -2135,10 +2154,9 @@ var init_tasks_pending_queue = __esm({
2135
2154
  static getName(name = "empty") {
2136
2155
  return `task:${name}:${++_TasksPendingQueue.counter}`;
2137
2156
  }
2138
- static {
2139
- this.counter = 0;
2140
- }
2141
2157
  };
2158
+ TasksPendingQueue = _TasksPendingQueue;
2159
+ TasksPendingQueue.counter = 0;
2142
2160
  }
2143
2161
  });
2144
2162
  function pluginContext(task, commands) {
@@ -2195,18 +2213,20 @@ var init_git_executor_chain = __esm({
2195
2213
  this._queue.push(task);
2196
2214
  return this._chain = this._chain.then(() => this.attemptTask(task));
2197
2215
  }
2198
- async attemptTask(task) {
2199
- const onScheduleComplete = await this._scheduler.next();
2200
- const onQueueComplete = () => this._queue.complete(task);
2201
- try {
2202
- const { logger } = this._queue.attempt(task);
2203
- return await (isEmptyTask(task) ? this.attemptEmptyTask(task, logger) : this.attemptRemoteTask(task, logger));
2204
- } catch (e) {
2205
- throw this.onFatalException(task, e);
2206
- } finally {
2207
- onQueueComplete();
2208
- onScheduleComplete();
2209
- }
2216
+ attemptTask(task) {
2217
+ return __async(this, null, function* () {
2218
+ const onScheduleComplete = yield this._scheduler.next();
2219
+ const onQueueComplete = () => this._queue.complete(task);
2220
+ try {
2221
+ const { logger } = this._queue.attempt(task);
2222
+ return yield isEmptyTask(task) ? this.attemptEmptyTask(task, logger) : this.attemptRemoteTask(task, logger);
2223
+ } catch (e) {
2224
+ throw this.onFatalException(task, e);
2225
+ } finally {
2226
+ onQueueComplete();
2227
+ onScheduleComplete();
2228
+ }
2229
+ });
2210
2230
  }
2211
2231
  onFatalException(task, e) {
2212
2232
  const gitError = e instanceof GitError ? Object.assign(e, { task }) : new GitError(task, e && String(e));
@@ -2214,30 +2234,34 @@ var init_git_executor_chain = __esm({
2214
2234
  this._queue.fatal(gitError);
2215
2235
  return gitError;
2216
2236
  }
2217
- async attemptRemoteTask(task, logger) {
2218
- const binary = this._plugins.exec("spawn.binary", "", pluginContext(task, task.commands));
2219
- const args = this._plugins.exec(
2220
- "spawn.args",
2221
- [...task.commands],
2222
- pluginContext(task, task.commands)
2223
- );
2224
- const raw = await this.gitResponse(
2225
- task,
2226
- binary,
2227
- args,
2228
- this.outputHandler,
2229
- logger.step("SPAWN")
2230
- );
2231
- const outputStreams = await this.handleTaskData(task, args, raw, logger.step("HANDLE"));
2232
- logger(`passing response to task's parser as a %s`, task.format);
2233
- if (isBufferTask(task)) {
2234
- return callTaskParser(task.parser, outputStreams);
2235
- }
2236
- return callTaskParser(task.parser, outputStreams.asStrings());
2237
+ attemptRemoteTask(task, logger) {
2238
+ return __async(this, null, function* () {
2239
+ const binary = this._plugins.exec("spawn.binary", "", pluginContext(task, task.commands));
2240
+ const args = this._plugins.exec(
2241
+ "spawn.args",
2242
+ [...task.commands],
2243
+ pluginContext(task, task.commands)
2244
+ );
2245
+ const raw = yield this.gitResponse(
2246
+ task,
2247
+ binary,
2248
+ args,
2249
+ this.outputHandler,
2250
+ logger.step("SPAWN")
2251
+ );
2252
+ const outputStreams = yield this.handleTaskData(task, args, raw, logger.step("HANDLE"));
2253
+ logger(`passing response to task's parser as a %s`, task.format);
2254
+ if (isBufferTask(task)) {
2255
+ return callTaskParser(task.parser, outputStreams);
2256
+ }
2257
+ return callTaskParser(task.parser, outputStreams.asStrings());
2258
+ });
2237
2259
  }
2238
- async attemptEmptyTask(task, logger) {
2239
- logger(`empty task bypassing child process to call to task's parser`);
2240
- return task.parser(this);
2260
+ attemptEmptyTask(task, logger) {
2261
+ return __async(this, null, function* () {
2262
+ logger(`empty task bypassing child process to call to task's parser`);
2263
+ return task.parser(this);
2264
+ });
2241
2265
  }
2242
2266
  handleTaskData(task, args, result, logger) {
2243
2267
  const { exitCode, rejection, stdOut, stdErr } = result;
@@ -2246,10 +2270,7 @@ var init_git_executor_chain = __esm({
2246
2270
  const { error } = this._plugins.exec(
2247
2271
  "task.error",
2248
2272
  { error: rejection },
2249
- {
2250
- ...pluginContext(task, args),
2251
- ...result
2252
- }
2273
+ __spreadValues(__spreadValues({}, pluginContext(task, args)), result)
2253
2274
  );
2254
2275
  if (error && task.onError) {
2255
2276
  logger.info(`exitCode=%s handling with custom error handler`);
@@ -2282,80 +2303,79 @@ var init_git_executor_chain = __esm({
2282
2303
  done(new GitOutputStreams(Buffer.concat(stdOut), Buffer.concat(stdErr)));
2283
2304
  });
2284
2305
  }
2285
- async gitResponse(task, command, args, outputHandler, logger) {
2286
- const outputLogger = logger.sibling("output");
2287
- const spawnOptions = this._plugins.exec(
2288
- "spawn.options",
2289
- {
2290
- cwd: this.cwd,
2291
- env: this.env,
2292
- windowsHide: true
2293
- },
2294
- pluginContext(task, task.commands)
2295
- );
2296
- return new Promise((done) => {
2297
- const stdOut = [];
2298
- const stdErr = [];
2299
- logger.info(`%s %o`, command, args);
2300
- logger("%O", spawnOptions);
2301
- let rejection = this._beforeSpawn(task, args);
2302
- if (rejection) {
2303
- return done({
2304
- stdOut,
2305
- stdErr,
2306
- exitCode: 9901,
2307
- rejection
2308
- });
2309
- }
2310
- this._plugins.exec("spawn.before", void 0, {
2311
- ...pluginContext(task, args),
2312
- kill(reason) {
2313
- rejection = reason || rejection;
2314
- }
2315
- });
2316
- const spawned = (0, import_child_process.spawn)(command, args, spawnOptions);
2317
- spawned.stdout.on(
2318
- "data",
2319
- onDataReceived(stdOut, "stdOut", logger, outputLogger.step("stdOut"))
2320
- );
2321
- spawned.stderr.on(
2322
- "data",
2323
- onDataReceived(stdErr, "stdErr", logger, outputLogger.step("stdErr"))
2306
+ gitResponse(task, command, args, outputHandler, logger) {
2307
+ return __async(this, null, function* () {
2308
+ const outputLogger = logger.sibling("output");
2309
+ const spawnOptions = this._plugins.exec(
2310
+ "spawn.options",
2311
+ {
2312
+ cwd: this.cwd,
2313
+ env: this.env,
2314
+ windowsHide: true
2315
+ },
2316
+ pluginContext(task, task.commands)
2324
2317
  );
2325
- spawned.on("error", onErrorReceived(stdErr, logger));
2326
- if (outputHandler) {
2327
- logger(`Passing child process stdOut/stdErr to custom outputHandler`);
2328
- outputHandler(command, spawned.stdout, spawned.stderr, [...args]);
2329
- }
2330
- this._plugins.exec("spawn.after", void 0, {
2331
- ...pluginContext(task, args),
2332
- spawned,
2333
- close(exitCode, reason) {
2334
- done({
2318
+ return new Promise((done) => {
2319
+ const stdOut = [];
2320
+ const stdErr = [];
2321
+ logger.info(`%s %o`, command, args);
2322
+ logger("%O", spawnOptions);
2323
+ let rejection = this._beforeSpawn(task, args);
2324
+ if (rejection) {
2325
+ return done({
2335
2326
  stdOut,
2336
2327
  stdErr,
2337
- exitCode,
2338
- rejection: rejection || reason
2328
+ exitCode: 9901,
2329
+ rejection
2339
2330
  });
2340
- },
2341
- kill(reason) {
2342
- if (spawned.killed) {
2343
- return;
2331
+ }
2332
+ this._plugins.exec("spawn.before", void 0, __spreadProps(__spreadValues({}, pluginContext(task, args)), {
2333
+ kill(reason) {
2334
+ rejection = reason || rejection;
2344
2335
  }
2345
- rejection = reason;
2346
- spawned.kill("SIGINT");
2336
+ }));
2337
+ const spawned = (0, import_child_process.spawn)(command, args, spawnOptions);
2338
+ spawned.stdout.on(
2339
+ "data",
2340
+ onDataReceived(stdOut, "stdOut", logger, outputLogger.step("stdOut"))
2341
+ );
2342
+ spawned.stderr.on(
2343
+ "data",
2344
+ onDataReceived(stdErr, "stdErr", logger, outputLogger.step("stdErr"))
2345
+ );
2346
+ spawned.on("error", onErrorReceived(stdErr, logger));
2347
+ if (outputHandler) {
2348
+ logger(`Passing child process stdOut/stdErr to custom outputHandler`);
2349
+ outputHandler(command, spawned.stdout, spawned.stderr, [...args]);
2347
2350
  }
2351
+ this._plugins.exec("spawn.after", void 0, __spreadProps(__spreadValues({}, pluginContext(task, args)), {
2352
+ spawned,
2353
+ close(exitCode, reason) {
2354
+ done({
2355
+ stdOut,
2356
+ stdErr,
2357
+ exitCode,
2358
+ rejection: rejection || reason
2359
+ });
2360
+ },
2361
+ kill(reason) {
2362
+ if (spawned.killed) {
2363
+ return;
2364
+ }
2365
+ rejection = reason;
2366
+ spawned.kill("SIGINT");
2367
+ }
2368
+ }));
2348
2369
  });
2349
2370
  });
2350
2371
  }
2351
2372
  _beforeSpawn(task, args) {
2352
2373
  let rejection;
2353
- this._plugins.exec("spawn.before", void 0, {
2354
- ...pluginContext(task, args),
2374
+ this._plugins.exec("spawn.before", void 0, __spreadProps(__spreadValues({}, pluginContext(task, args)), {
2355
2375
  kill(reason) {
2356
2376
  rejection = reason || rejection;
2357
2377
  }
2358
- });
2378
+ }));
2359
2379
  return rejection;
2360
2380
  }
2361
2381
  };
@@ -2391,7 +2411,7 @@ function taskCallback(task, response, callback = NOOP) {
2391
2411
  callback(null, data);
2392
2412
  };
2393
2413
  const onError2 = (err) => {
2394
- if (err?.task === task) {
2414
+ if ((err == null ? void 0 : err.task) === task) {
2395
2415
  callback(
2396
2416
  err instanceof GitResponseError ? addDeprecationNoticeToError(err) : err,
2397
2417
  void 0
@@ -2515,7 +2535,7 @@ var init_count_objects = __esm({
2515
2535
  /([a-z-]+): (\d+)$/,
2516
2536
  (result, [key, value]) => {
2517
2537
  const property = asCamelCase(key);
2518
- if (Object.hasOwn(result, property)) {
2538
+ if (result.hasOwnProperty(property)) {
2519
2539
  result[property] = asNumber(value);
2520
2540
  }
2521
2541
  }
@@ -2603,10 +2623,7 @@ function commit_default() {
2603
2623
  const task = rejectDeprecatedSignatures(message) || commitTask(
2604
2624
  asArray(message),
2605
2625
  asArray(filterType(rest[0], filterStringOrStringArray, [])),
2606
- [
2607
- ...asStringArray(filterType(rest[1], filterArray, [])),
2608
- ...getTrailingOptions(arguments, 0, true)
2609
- ]
2626
+ [...filterType(rest[1], filterArray, []), ...getTrailingOptions(arguments, 0, true)]
2610
2627
  );
2611
2628
  return this._runTask(task, next);
2612
2629
  }
@@ -2796,8 +2813,8 @@ var init_parse_diff_summary = __esm({
2796
2813
  const inserted = /(\d+) i/.exec(summary);
2797
2814
  const deleted = /(\d+) d/.exec(summary);
2798
2815
  result.changed = asNumber(changed);
2799
- result.insertions = asNumber(inserted?.[1]);
2800
- result.deletions = asNumber(deleted?.[1]);
2816
+ result.insertions = asNumber(inserted == null ? void 0 : inserted[1]);
2817
+ result.deletions = asNumber(deleted == null ? void 0 : deleted[1]);
2801
2818
  }
2802
2819
  )
2803
2820
  ];
@@ -2847,7 +2864,7 @@ var init_parse_diff_summary = __esm({
2847
2864
  (result, [status, similarity, from, _to, to]) => {
2848
2865
  result.changed++;
2849
2866
  result.files.push({
2850
- file: to ?? from,
2867
+ file: to != null ? to : from,
2851
2868
  changes: 0,
2852
2869
  insertions: 0,
2853
2870
  deletions: 0,
@@ -2989,7 +3006,7 @@ function userOptions(input) {
2989
3006
  }
2990
3007
  function parseLogOptions(opt = {}, customArgs = []) {
2991
3008
  const splitter = filterType(opt.splitter, filterString, SPLITTER);
2992
- const format = filterPlainObject(opt.format) ? opt.format : {
3009
+ const format = !filterPrimitives(opt.format) && opt.format ? opt.format : {
2993
3010
  hash: "%H",
2994
3011
  date: opt.strictDate === false ? "%ai" : "%aI",
2995
3012
  message: "%s",
@@ -3036,7 +3053,7 @@ function log_default() {
3036
3053
  const next = trailingFunctionArgument(arguments);
3037
3054
  const options = parseLogOptions(
3038
3055
  trailingOptionsArgument(arguments),
3039
- asStringArray(filterType(arguments[0], filterArray, []))
3056
+ filterType(arguments[0], filterArray)
3040
3057
  );
3041
3058
  const task = rejectDeprecatedSignatures(...rest) || validateLogFormatConfig(options.commands) || createLogTask(options);
3042
3059
  return this._runTask(task, next);
@@ -3405,10 +3422,9 @@ var init_parse_push = __esm({
3405
3422
  result.repo = repo;
3406
3423
  }),
3407
3424
  new LineParser(/^updating local tracking ref '(.+)'/, (result, [local]) => {
3408
- result.ref = {
3409
- ...result.ref || {},
3425
+ result.ref = __spreadProps(__spreadValues({}, result.ref || {}), {
3410
3426
  local
3411
- };
3427
+ });
3412
3428
  }),
3413
3429
  new LineParser(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/, (result, [local, remote, type]) => {
3414
3430
  result.pushed.push(pushResultPushedItem(local, remote, type));
@@ -3416,12 +3432,11 @@ var init_parse_push = __esm({
3416
3432
  new LineParser(
3417
3433
  /^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,
3418
3434
  (result, [local, remote, remoteName]) => {
3419
- result.branch = {
3420
- ...result.branch || {},
3435
+ result.branch = __spreadProps(__spreadValues({}, result.branch || {}), {
3421
3436
  local,
3422
3437
  remote,
3423
3438
  remoteName
3424
- };
3439
+ });
3425
3440
  }
3426
3441
  ),
3427
3442
  new LineParser(
@@ -3443,10 +3458,7 @@ var init_parse_push = __esm({
3443
3458
  parsePushResult = (stdOut, stdErr) => {
3444
3459
  const pushDetail = parsePushDetail(stdOut, stdErr);
3445
3460
  const responseDetail = parseRemoteMessages(stdOut, stdErr);
3446
- return {
3447
- ...pushDetail,
3448
- ...responseDetail
3449
- };
3461
+ return __spreadValues(__spreadValues({}, pushDetail), responseDetail);
3450
3462
  };
3451
3463
  parsePushDetail = (stdOut, stdErr) => {
3452
3464
  return parseStringResponse({ pushed: [] }, parsers5, [stdOut, stdErr]);
@@ -3680,19 +3692,18 @@ var init_StatusSummary = __esm({
3680
3692
  const behindReg = /behind (\d+)/;
3681
3693
  const currentReg = /^(.+?(?=(?:\.{3}|\s|$)))/;
3682
3694
  const trackingReg = /\.{3}(\S*)/;
3683
- const onEmptyBranchReg = /\son\s(\S+?)(?=\.{3}|$)/;
3684
- let regexResult = aheadReg.exec(line);
3695
+ const onEmptyBranchReg = /\son\s([\S]+)$/;
3696
+ let regexResult;
3697
+ regexResult = aheadReg.exec(line);
3685
3698
  result.ahead = regexResult && +regexResult[1] || 0;
3686
3699
  regexResult = behindReg.exec(line);
3687
3700
  result.behind = regexResult && +regexResult[1] || 0;
3688
3701
  regexResult = currentReg.exec(line);
3689
- result.current = filterType(regexResult?.[1], filterString, null);
3702
+ result.current = regexResult && regexResult[1];
3690
3703
  regexResult = trackingReg.exec(line);
3691
- result.tracking = filterType(regexResult?.[1], filterString, null);
3704
+ result.tracking = regexResult && regexResult[1];
3692
3705
  regexResult = onEmptyBranchReg.exec(line);
3693
- if (regexResult) {
3694
- result.current = filterType(regexResult?.[1], filterString, result.current);
3695
- }
3706
+ result.current = regexResult && regexResult[1] || result.current;
3696
3707
  result.detached = /\(no branch\)/.test(line);
3697
3708
  }
3698
3709
  ]
@@ -3863,7 +3874,7 @@ var init_simple_git_api = __esm({
3863
3874
  if (typeof directory === "string") {
3864
3875
  return this._runTask(changeWorkingDirectoryTask(directory, this._executor), next);
3865
3876
  }
3866
- if (typeof directory?.path === "string") {
3877
+ if (typeof (directory == null ? void 0 : directory.path) === "string") {
3867
3878
  return this._runTask(
3868
3879
  changeWorkingDirectoryTask(
3869
3880
  directory.path,
@@ -4113,15 +4124,10 @@ var init_BranchSummary = __esm({
4113
4124
  function branchStatus(input) {
4114
4125
  return input ? input.charAt(0) : "";
4115
4126
  }
4116
- function parseBranchSummary(stdOut, currentOnly = false) {
4117
- return parseStringResponse(
4118
- new BranchSummaryResult(),
4119
- currentOnly ? [currentBranchParser] : parsers9,
4120
- stdOut
4121
- );
4127
+ function parseBranchSummary(stdOut) {
4128
+ return parseStringResponse(new BranchSummaryResult(), parsers9, stdOut);
4122
4129
  }
4123
4130
  var parsers9;
4124
- var currentBranchParser;
4125
4131
  var init_parse_branch = __esm({
4126
4132
  "src/lib/parsers/parse-branch.ts"() {
4127
4133
  "use strict";
@@ -4135,15 +4141,12 @@ var init_parse_branch = __esm({
4135
4141
  }
4136
4142
  ),
4137
4143
  new LineParser(
4138
- /^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,
4144
+ new RegExp("^([*+]\\s)?(\\S+)\\s+([a-z0-9]+)\\s?(.*)$", "s"),
4139
4145
  (result, [current, name, commit, label]) => {
4140
4146
  result.push(branchStatus(current), false, name, commit, label);
4141
4147
  }
4142
4148
  )
4143
4149
  ];
4144
- currentBranchParser = new LineParser(/^(\S+)$/s, (result, [name]) => {
4145
- result.push("*", false, name, "", "");
4146
- });
4147
4150
  }
4148
4151
  });
4149
4152
  var branch_exports = {};
@@ -4160,7 +4163,6 @@ function containsDeleteBranchCommand(commands) {
4160
4163
  }
4161
4164
  function branchTask(customArgs) {
4162
4165
  const isDelete = containsDeleteBranchCommand(customArgs);
4163
- const isCurrentOnly = customArgs.includes("--show-current");
4164
4166
  const commands = ["branch", ...customArgs];
4165
4167
  if (commands.length === 1) {
4166
4168
  commands.push("-a");
@@ -4175,17 +4177,16 @@ function branchTask(customArgs) {
4175
4177
  if (isDelete) {
4176
4178
  return parseBranchDeletions(stdOut, stdErr).all[0];
4177
4179
  }
4178
- return parseBranchSummary(stdOut, isCurrentOnly);
4180
+ return parseBranchSummary(stdOut);
4179
4181
  }
4180
4182
  };
4181
4183
  }
4182
4184
  function branchLocalTask() {
4185
+ const parser4 = parseBranchSummary;
4183
4186
  return {
4184
4187
  format: "utf-8",
4185
4188
  commands: ["branch", "-v"],
4186
- parser(stdOut) {
4187
- return parseBranchSummary(stdOut);
4188
- }
4189
+ parser: parser4
4189
4190
  };
4190
4191
  }
4191
4192
  function deleteBranchesTask(branches, forceDelete = false) {
@@ -4231,16 +4232,12 @@ var init_branch = __esm({
4231
4232
  init_utils();
4232
4233
  }
4233
4234
  });
4234
- function toPath(input) {
4235
- const path3 = input.trim().replace(/^["']|["']$/g, "");
4236
- return path3 && (0, import_node_path.normalize)(path3);
4237
- }
4238
4235
  var parseCheckIgnore;
4239
4236
  var init_CheckIgnore = __esm({
4240
4237
  "src/lib/responses/CheckIgnore.ts"() {
4241
4238
  "use strict";
4242
4239
  parseCheckIgnore = (text) => {
4243
- return text.split(/\n/g).map(toPath).filter(Boolean);
4240
+ return text.split(/\n/g).map((line) => line.trim()).filter((file) => !!file);
4244
4241
  };
4245
4242
  }
4246
4243
  });
@@ -4446,7 +4443,7 @@ function parseGetRemotes(text) {
4446
4443
  function parseGetRemotesVerbose(text) {
4447
4444
  const remotes = {};
4448
4445
  forEach(text, ([name, url, purpose]) => {
4449
- if (!Object.hasOwn(remotes, name)) {
4446
+ if (!remotes.hasOwnProperty(name)) {
4450
4447
  remotes[name] = {
4451
4448
  name,
4452
4449
  refs: { fetch: "", push: "" }
@@ -4570,8 +4567,8 @@ var init_sub_module = __esm({
4570
4567
  }
4571
4568
  });
4572
4569
  function singleSorted(a, b) {
4573
- const aIsNum = Number.isNaN(a);
4574
- const bIsNum = Number.isNaN(b);
4570
+ const aIsNum = isNaN(a);
4571
+ const bIsNum = isNaN(b);
4575
4572
  if (aIsNum !== bIsNum) {
4576
4573
  return aIsNum ? 1 : -1;
4577
4574
  }
@@ -5199,24 +5196,27 @@ function completionDetectionPlugin({
5199
5196
  }
5200
5197
  return {
5201
5198
  type: "spawn.after",
5202
- async action(_data, { spawned, close }) {
5203
- const events = createEvents();
5204
- let deferClose = true;
5205
- let quickClose = () => void (deferClose = false);
5206
- spawned.stdout?.on("data", quickClose);
5207
- spawned.stderr?.on("data", quickClose);
5208
- spawned.on("error", quickClose);
5209
- spawned.on("close", (code) => events.close(code));
5210
- spawned.on("exit", (code) => events.exit(code));
5211
- try {
5212
- await events.result;
5213
- if (deferClose) {
5214
- await delay(50);
5199
+ action(_0, _1) {
5200
+ return __async(this, arguments, function* (_data, { spawned, close }) {
5201
+ var _a3, _b;
5202
+ const events = createEvents();
5203
+ let deferClose = true;
5204
+ let quickClose = () => void (deferClose = false);
5205
+ (_a3 = spawned.stdout) == null ? void 0 : _a3.on("data", quickClose);
5206
+ (_b = spawned.stderr) == null ? void 0 : _b.on("data", quickClose);
5207
+ spawned.on("error", quickClose);
5208
+ spawned.on("close", (code) => events.close(code));
5209
+ spawned.on("exit", (code) => events.exit(code));
5210
+ try {
5211
+ yield events.result;
5212
+ if (deferClose) {
5213
+ yield delay(50);
5214
+ }
5215
+ close(events.exitCode);
5216
+ } catch (err) {
5217
+ close(events.exitCode, err);
5215
5218
  }
5216
- close(events.exitCode);
5217
- } catch (err) {
5218
- close(events.exitCode, err);
5219
- }
5219
+ });
5220
5220
  }
5221
5221
  };
5222
5222
  }
@@ -5330,10 +5330,11 @@ function progressMonitorPlugin(progress) {
5330
5330
  const onProgress = {
5331
5331
  type: "spawn.after",
5332
5332
  action(_data, context) {
5333
+ var _a2;
5333
5334
  if (!context.commands.includes(progressCommand)) {
5334
5335
  return;
5335
5336
  }
5336
- context.spawned.stderr?.on("data", (chunk) => {
5337
+ (_a2 = context.spawned.stderr) == null ? void 0 : _a2.on("data", (chunk) => {
5337
5338
  const message = /^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(chunk.toString("utf8"));
5338
5339
  if (!message) {
5339
5340
  return;
@@ -5368,7 +5369,7 @@ function spawnOptionsPlugin(spawnOptions) {
5368
5369
  return {
5369
5370
  type: "spawn.options",
5370
5371
  action(data) {
5371
- return { ...options, ...data };
5372
+ return __spreadValues(__spreadValues({}, options), data);
5372
5373
  }
5373
5374
  };
5374
5375
  }
@@ -5381,14 +5382,16 @@ function timeoutPlugin({
5381
5382
  return {
5382
5383
  type: "spawn.after",
5383
5384
  action(_data, context) {
5385
+ var _a2, _b;
5384
5386
  let timeout;
5385
5387
  function wait() {
5386
5388
  timeout && clearTimeout(timeout);
5387
5389
  timeout = setTimeout(kill, block);
5388
5390
  }
5389
5391
  function stop() {
5390
- context.spawned.stdout?.off("data", wait);
5391
- context.spawned.stderr?.off("data", wait);
5392
+ var _a3, _b2;
5393
+ (_a3 = context.spawned.stdout) == null ? void 0 : _a3.off("data", wait);
5394
+ (_b2 = context.spawned.stderr) == null ? void 0 : _b2.off("data", wait);
5392
5395
  context.spawned.off("exit", stop);
5393
5396
  context.spawned.off("close", stop);
5394
5397
  timeout && clearTimeout(timeout);
@@ -5397,8 +5400,8 @@ function timeoutPlugin({
5397
5400
  stop();
5398
5401
  context.kill(new GitPluginError(void 0, "timeout", `block timeout reached`));
5399
5402
  }
5400
- stdOut && context.spawned.stdout?.on("data", wait);
5401
- stdErr && context.spawned.stderr?.on("data", wait);
5403
+ stdOut && ((_a2 = context.spawned.stdout) == null ? void 0 : _a2.on("data", wait));
5404
+ stdErr && ((_b = context.spawned.stderr) == null ? void 0 : _b.on("data", wait));
5402
5405
  context.spawned.on("exit", stop);
5403
5406
  context.spawned.on("close", stop);
5404
5407
  wait();
@@ -5437,6 +5440,7 @@ function suffixPathsPlugin() {
5437
5440
  init_utils();
5438
5441
  var Git = require_git();
5439
5442
  function gitInstanceFactory(baseDir, options) {
5443
+ var _a2;
5440
5444
  const plugins = new PluginStore();
5441
5445
  const config = createInstanceConfig(
5442
5446
  baseDir && (typeof baseDir === "string" ? { baseDir } : baseDir) || {},
@@ -5460,18 +5464,26 @@ function gitInstanceFactory(baseDir, options) {
5460
5464
  config.spawnOptions && plugins.add(spawnOptionsPlugin(config.spawnOptions));
5461
5465
  plugins.add(errorDetectionPlugin(errorDetectionHandler(true)));
5462
5466
  config.errors && plugins.add(errorDetectionPlugin(config.errors));
5463
- customBinaryPlugin(plugins, config.binary, config.unsafe?.allowUnsafeCustomBinary);
5467
+ customBinaryPlugin(plugins, config.binary, (_a2 = config.unsafe) == null ? void 0 : _a2.allowUnsafeCustomBinary);
5464
5468
  return new Git(config, plugins);
5465
5469
  }
5466
5470
  init_git_response_error();
5467
5471
  var simpleGit = gitInstanceFactory;
5468
5472
 
5469
5473
  // ../reporter-core/dist/index.js
5474
+ var import_crypto = require("crypto");
5470
5475
  var import_fs = __toESM(require("fs"), 1);
5471
- var import_path = __toESM(require("path"), 1);
5472
5476
  var import_fs2 = __toESM(require("fs"), 1);
5473
- var import_crypto = require("crypto");
5477
+ var import_path = __toESM(require("path"), 1);
5474
5478
  var import_fs3 = __toESM(require("fs"), 1);
5479
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
5480
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5481
+ }) : x)(function(x) {
5482
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5483
+ throw Error('Dynamic require of "' + x + '" is not supported');
5484
+ });
5485
+ var _fetch = typeof globalThis.fetch !== "undefined" ? globalThis.fetch : __require("node-fetch");
5486
+ var _AbortController = typeof globalThis.AbortController !== "undefined" ? globalThis.AbortController : __require("abort-controller").AbortController;
5475
5487
  var defaultRetryConfig = {
5476
5488
  maxAttempts: 3,
5477
5489
  baseDelayMs: 1e3,
@@ -5568,13 +5580,13 @@ var SupatestApiClient = class {
5568
5580
  async request(method, path22, body) {
5569
5581
  const url = `${this.options.apiUrl}${path22}`;
5570
5582
  return withRetry(async () => {
5571
- const controller = new AbortController();
5583
+ const controller = new _AbortController();
5572
5584
  const timeoutId = setTimeout(
5573
5585
  () => controller.abort(),
5574
5586
  this.options.timeoutMs
5575
5587
  );
5576
5588
  try {
5577
- const response = await fetch(url, {
5589
+ const response = await _fetch(url, {
5578
5590
  method,
5579
5591
  headers: {
5580
5592
  "Content-Type": "application/json",
@@ -5768,6 +5780,126 @@ async function getLocalGitInfo(rootDir) {
5768
5780
  return {};
5769
5781
  }
5770
5782
  }
5783
+ function hashKey(value) {
5784
+ return (0, import_crypto.createHash)("sha256").update(value).digest("hex").slice(0, 12);
5785
+ }
5786
+ function getFileSize(filePath) {
5787
+ try {
5788
+ return import_fs.default.statSync(filePath).size;
5789
+ } catch {
5790
+ return 0;
5791
+ }
5792
+ }
5793
+ function getErrorMessage2(error) {
5794
+ if (error instanceof Error) return error.message;
5795
+ return String(error);
5796
+ }
5797
+ function relativePath(filePath, rootDir) {
5798
+ let normalizedPath = filePath;
5799
+ if (normalizedPath.startsWith("file:///")) {
5800
+ normalizedPath = normalizedPath.slice(7);
5801
+ } else if (normalizedPath.startsWith("file://")) {
5802
+ normalizedPath = normalizedPath.slice(7);
5803
+ }
5804
+ if (rootDir && normalizedPath.startsWith(rootDir)) {
5805
+ return normalizedPath.slice(rootDir.length + 1);
5806
+ }
5807
+ return filePath;
5808
+ }
5809
+ function logInfo(message) {
5810
+ console.log(`[supatest] ${message}`);
5811
+ }
5812
+ function logWarn(message) {
5813
+ console.warn(`[supatest] ${message}`);
5814
+ }
5815
+ function getCIInfo() {
5816
+ if (process.env.GITHUB_ACTIONS) {
5817
+ return {
5818
+ provider: "github-actions",
5819
+ runId: process.env.GITHUB_RUN_ID,
5820
+ jobId: process.env.GITHUB_JOB,
5821
+ jobUrl: `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`,
5822
+ buildNumber: process.env.GITHUB_RUN_NUMBER,
5823
+ branch: process.env.GITHUB_REF_NAME,
5824
+ pullRequest: process.env.GITHUB_EVENT_NAME === "pull_request" ? {
5825
+ number: process.env.GITHUB_PR_NUMBER ?? "",
5826
+ url: `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/pull/${process.env.GITHUB_PR_NUMBER}`
5827
+ } : void 0
5828
+ };
5829
+ }
5830
+ if (process.env.GITLAB_CI) {
5831
+ return {
5832
+ provider: "gitlab-ci",
5833
+ runId: process.env.CI_PIPELINE_ID,
5834
+ jobId: process.env.CI_JOB_ID,
5835
+ jobUrl: process.env.CI_JOB_URL,
5836
+ buildNumber: process.env.CI_PIPELINE_IID,
5837
+ branch: process.env.CI_COMMIT_BRANCH,
5838
+ pullRequest: process.env.CI_MERGE_REQUEST_IID ? {
5839
+ number: process.env.CI_MERGE_REQUEST_IID,
5840
+ url: process.env.CI_MERGE_REQUEST_PROJECT_URL + "/-/merge_requests/" + process.env.CI_MERGE_REQUEST_IID,
5841
+ title: process.env.CI_MERGE_REQUEST_TITLE
5842
+ } : void 0
5843
+ };
5844
+ }
5845
+ if (process.env.JENKINS_URL) {
5846
+ return {
5847
+ provider: "jenkins",
5848
+ runId: process.env.BUILD_ID,
5849
+ jobUrl: process.env.BUILD_URL,
5850
+ buildNumber: process.env.BUILD_NUMBER,
5851
+ branch: process.env.GIT_BRANCH
5852
+ };
5853
+ }
5854
+ if (process.env.CIRCLECI) {
5855
+ return {
5856
+ provider: "circleci",
5857
+ runId: process.env.CIRCLE_WORKFLOW_ID,
5858
+ jobId: process.env.CIRCLE_JOB,
5859
+ jobUrl: process.env.CIRCLE_BUILD_URL,
5860
+ buildNumber: process.env.CIRCLE_BUILD_NUM,
5861
+ branch: process.env.CIRCLE_BRANCH,
5862
+ pullRequest: process.env.CIRCLE_PULL_REQUEST ? {
5863
+ number: process.env.CIRCLE_PR_NUMBER ?? "",
5864
+ url: process.env.CIRCLE_PULL_REQUEST
5865
+ } : void 0
5866
+ };
5867
+ }
5868
+ if (process.env.TRAVIS) {
5869
+ return {
5870
+ provider: "travis",
5871
+ runId: process.env.TRAVIS_BUILD_ID,
5872
+ jobId: process.env.TRAVIS_JOB_ID,
5873
+ jobUrl: process.env.TRAVIS_JOB_WEB_URL,
5874
+ buildNumber: process.env.TRAVIS_BUILD_NUMBER,
5875
+ branch: process.env.TRAVIS_BRANCH,
5876
+ pullRequest: process.env.TRAVIS_PULL_REQUEST !== "false" ? {
5877
+ number: process.env.TRAVIS_PULL_REQUEST ?? "",
5878
+ url: `https://github.com/${process.env.TRAVIS_REPO_SLUG}/pull/${process.env.TRAVIS_PULL_REQUEST}`
5879
+ } : void 0
5880
+ };
5881
+ }
5882
+ if (process.env.BUILDKITE) {
5883
+ return {
5884
+ provider: "buildkite",
5885
+ runId: process.env.BUILDKITE_BUILD_ID,
5886
+ jobId: process.env.BUILDKITE_JOB_ID,
5887
+ jobUrl: process.env.BUILDKITE_BUILD_URL,
5888
+ buildNumber: process.env.BUILDKITE_BUILD_NUMBER,
5889
+ branch: process.env.BUILDKITE_BRANCH
5890
+ };
5891
+ }
5892
+ if (process.env.AZURE_PIPELINES || process.env.TF_BUILD) {
5893
+ return {
5894
+ provider: "azure-pipelines",
5895
+ runId: process.env.BUILD_BUILDID,
5896
+ jobUrl: `${process.env.SYSTEM_COLLECTIONURI}${process.env.SYSTEM_TEAMPROJECT}/_build/results?buildId=${process.env.BUILD_BUILDID}`,
5897
+ buildNumber: process.env.BUILD_BUILDNUMBER,
5898
+ branch: process.env.BUILD_SOURCEBRANCH
5899
+ };
5900
+ }
5901
+ return void 0;
5902
+ }
5771
5903
  var CONTEXT_LINES_BEFORE = 3;
5772
5904
  var CONTEXT_LINES_AFTER = 3;
5773
5905
  var MAX_SNIPPET_SIZE = 2e3;
@@ -5784,7 +5916,7 @@ var SourceReader = class {
5784
5916
  */
5785
5917
  buildFileIndex(dir) {
5786
5918
  try {
5787
- const entries = import_fs.default.readdirSync(dir, { withFileTypes: true });
5919
+ const entries = import_fs2.default.readdirSync(dir, { withFileTypes: true });
5788
5920
  for (const entry of entries) {
5789
5921
  const fullPath = import_path.default.join(dir, entry.name);
5790
5922
  if (entry.isDirectory()) {
@@ -5813,14 +5945,14 @@ var SourceReader = class {
5813
5945
  */
5814
5946
  resolvePath(file) {
5815
5947
  if (import_path.default.isAbsolute(file)) {
5816
- if (import_fs.default.existsSync(file)) {
5948
+ if (import_fs2.default.existsSync(file)) {
5817
5949
  return file;
5818
5950
  }
5819
5951
  const filename2 = import_path.default.basename(file);
5820
5952
  return this.fileIndex.get(filename2);
5821
5953
  }
5822
5954
  const asRelative = import_path.default.join(this.rootDir, file);
5823
- if (import_fs.default.existsSync(asRelative)) {
5955
+ if (import_fs2.default.existsSync(asRelative)) {
5824
5956
  return asRelative;
5825
5957
  }
5826
5958
  if (this.fileIndex.has(file)) {
@@ -5841,7 +5973,7 @@ var SourceReader = class {
5841
5973
  }
5842
5974
  let lines = this.cache.get(absolutePath);
5843
5975
  if (!lines) {
5844
- const content = import_fs.default.readFileSync(absolutePath, "utf-8");
5976
+ const content = import_fs2.default.readFileSync(absolutePath, "utf-8");
5845
5977
  lines = content.split("\n");
5846
5978
  this.cache.set(absolutePath, lines);
5847
5979
  }
@@ -5883,7 +6015,7 @@ var AttachmentUploader = class {
5883
6015
  async upload(signedUrl, filePath, contentType) {
5884
6016
  if (this.options.dryRun) {
5885
6017
  try {
5886
- const stats = import_fs2.default.statSync(filePath);
6018
+ const stats = import_fs3.default.statSync(filePath);
5887
6019
  console.log(
5888
6020
  `[supatest][dry-run] Would upload ${filePath} (${stats.size} bytes) to S3`
5889
6021
  );
@@ -5897,25 +6029,25 @@ var AttachmentUploader = class {
5897
6029
  }
5898
6030
  let fileBuffer;
5899
6031
  try {
5900
- fileBuffer = await import_fs2.default.promises.readFile(filePath);
6032
+ fileBuffer = await import_fs3.default.promises.readFile(filePath);
5901
6033
  } catch (error) {
5902
6034
  const message = error instanceof Error ? error.message : String(error);
5903
6035
  throw new Error(`Failed to read file ${filePath}: ${message}`);
5904
6036
  }
5905
6037
  await withRetry(async () => {
5906
- const controller = new AbortController();
6038
+ const controller = new _AbortController();
5907
6039
  const timeoutId = setTimeout(
5908
6040
  () => controller.abort(),
5909
6041
  this.options.timeoutMs
5910
6042
  );
5911
6043
  try {
5912
- const response = await fetch(signedUrl, {
6044
+ const response = await _fetch(signedUrl, {
5913
6045
  method: "PUT",
5914
6046
  headers: {
5915
6047
  "Content-Type": contentType,
5916
6048
  "Content-Length": String(fileBuffer.length)
5917
6049
  },
5918
- body: new Uint8Array(fileBuffer),
6050
+ body: fileBuffer,
5919
6051
  signal: controller.signal
5920
6052
  });
5921
6053
  if (!response.ok) {
@@ -5966,126 +6098,6 @@ var AttachmentUploader = class {
5966
6098
  });
5967
6099
  }
5968
6100
  };
5969
- function hashKey(value) {
5970
- return (0, import_crypto.createHash)("sha256").update(value).digest("hex").slice(0, 12);
5971
- }
5972
- function getFileSize(filePath) {
5973
- try {
5974
- return import_fs3.default.statSync(filePath).size;
5975
- } catch {
5976
- return 0;
5977
- }
5978
- }
5979
- function getErrorMessage2(error) {
5980
- if (error instanceof Error) return error.message;
5981
- return String(error);
5982
- }
5983
- function relativePath(filePath, rootDir) {
5984
- let normalizedPath = filePath;
5985
- if (normalizedPath.startsWith("file:///")) {
5986
- normalizedPath = normalizedPath.slice(7);
5987
- } else if (normalizedPath.startsWith("file://")) {
5988
- normalizedPath = normalizedPath.slice(7);
5989
- }
5990
- if (rootDir && normalizedPath.startsWith(rootDir)) {
5991
- return normalizedPath.slice(rootDir.length + 1);
5992
- }
5993
- return filePath;
5994
- }
5995
- function logInfo(message) {
5996
- console.log(`[supatest] ${message}`);
5997
- }
5998
- function logWarn(message) {
5999
- console.warn(`[supatest] ${message}`);
6000
- }
6001
- function getCIInfo() {
6002
- if (process.env.GITHUB_ACTIONS) {
6003
- return {
6004
- provider: "github-actions",
6005
- runId: process.env.GITHUB_RUN_ID,
6006
- jobId: process.env.GITHUB_JOB,
6007
- jobUrl: `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`,
6008
- buildNumber: process.env.GITHUB_RUN_NUMBER,
6009
- branch: process.env.GITHUB_REF_NAME,
6010
- pullRequest: process.env.GITHUB_EVENT_NAME === "pull_request" ? {
6011
- number: process.env.GITHUB_PR_NUMBER ?? "",
6012
- url: `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/pull/${process.env.GITHUB_PR_NUMBER}`
6013
- } : void 0
6014
- };
6015
- }
6016
- if (process.env.GITLAB_CI) {
6017
- return {
6018
- provider: "gitlab-ci",
6019
- runId: process.env.CI_PIPELINE_ID,
6020
- jobId: process.env.CI_JOB_ID,
6021
- jobUrl: process.env.CI_JOB_URL,
6022
- buildNumber: process.env.CI_PIPELINE_IID,
6023
- branch: process.env.CI_COMMIT_BRANCH,
6024
- pullRequest: process.env.CI_MERGE_REQUEST_IID ? {
6025
- number: process.env.CI_MERGE_REQUEST_IID,
6026
- url: process.env.CI_MERGE_REQUEST_PROJECT_URL + "/-/merge_requests/" + process.env.CI_MERGE_REQUEST_IID,
6027
- title: process.env.CI_MERGE_REQUEST_TITLE
6028
- } : void 0
6029
- };
6030
- }
6031
- if (process.env.JENKINS_URL) {
6032
- return {
6033
- provider: "jenkins",
6034
- runId: process.env.BUILD_ID,
6035
- jobUrl: process.env.BUILD_URL,
6036
- buildNumber: process.env.BUILD_NUMBER,
6037
- branch: process.env.GIT_BRANCH
6038
- };
6039
- }
6040
- if (process.env.CIRCLECI) {
6041
- return {
6042
- provider: "circleci",
6043
- runId: process.env.CIRCLE_WORKFLOW_ID,
6044
- jobId: process.env.CIRCLE_JOB,
6045
- jobUrl: process.env.CIRCLE_BUILD_URL,
6046
- buildNumber: process.env.CIRCLE_BUILD_NUM,
6047
- branch: process.env.CIRCLE_BRANCH,
6048
- pullRequest: process.env.CIRCLE_PULL_REQUEST ? {
6049
- number: process.env.CIRCLE_PR_NUMBER ?? "",
6050
- url: process.env.CIRCLE_PULL_REQUEST
6051
- } : void 0
6052
- };
6053
- }
6054
- if (process.env.TRAVIS) {
6055
- return {
6056
- provider: "travis",
6057
- runId: process.env.TRAVIS_BUILD_ID,
6058
- jobId: process.env.TRAVIS_JOB_ID,
6059
- jobUrl: process.env.TRAVIS_JOB_WEB_URL,
6060
- buildNumber: process.env.TRAVIS_BUILD_NUMBER,
6061
- branch: process.env.TRAVIS_BRANCH,
6062
- pullRequest: process.env.TRAVIS_PULL_REQUEST !== "false" ? {
6063
- number: process.env.TRAVIS_PULL_REQUEST ?? "",
6064
- url: `https://github.com/${process.env.TRAVIS_REPO_SLUG}/pull/${process.env.TRAVIS_PULL_REQUEST}`
6065
- } : void 0
6066
- };
6067
- }
6068
- if (process.env.BUILDKITE) {
6069
- return {
6070
- provider: "buildkite",
6071
- runId: process.env.BUILDKITE_BUILD_ID,
6072
- jobId: process.env.BUILDKITE_JOB_ID,
6073
- jobUrl: process.env.BUILDKITE_BUILD_URL,
6074
- buildNumber: process.env.BUILDKITE_BUILD_NUMBER,
6075
- branch: process.env.BUILDKITE_BRANCH
6076
- };
6077
- }
6078
- if (process.env.AZURE_PIPELINES || process.env.TF_BUILD) {
6079
- return {
6080
- provider: "azure-pipelines",
6081
- runId: process.env.BUILD_BUILDID,
6082
- jobUrl: `${process.env.SYSTEM_COLLECTIONURI}${process.env.SYSTEM_TEAMPROJECT}/_build/results?buildId=${process.env.BUILD_BUILDID}`,
6083
- buildNumber: process.env.BUILD_BUILDNUMBER,
6084
- branch: process.env.BUILD_SOURCEBRANCH
6085
- };
6086
- }
6087
- return void 0;
6088
- }
6089
6101
 
6090
6102
  // src/index.ts
6091
6103
  var DEFAULT_API_URL = "https://code-api.supatest.ai";
@@ -6123,6 +6135,14 @@ var SupatestPlaywrightReporter = class {
6123
6135
  };
6124
6136
  }
6125
6137
  async onBegin(config, suite) {
6138
+ try {
6139
+ await this._onBegin(config, suite);
6140
+ } catch (error) {
6141
+ logWarn(`Supatest reporter error in onBegin: ${getErrorMessage2(error)}`);
6142
+ this.disabled = true;
6143
+ }
6144
+ }
6145
+ async _onBegin(config, suite) {
6126
6146
  this.config = config;
6127
6147
  this.rootDir = config.rootDir;
6128
6148
  this.sourceReader = new SourceReader(config.rootDir);
@@ -6212,19 +6232,30 @@ var SupatestPlaywrightReporter = class {
6212
6232
  }
6213
6233
  }
6214
6234
  onTestEnd(test, result) {
6215
- if (this.disabled || !this.runId) return;
6216
- if (!this.firstTestStartTime && result.startTime) {
6217
- this.firstTestStartTime = result.startTime.getTime();
6218
- }
6219
- if (!this.firstFailureTime && (result.status === "failed" || result.status === "timedOut")) {
6220
- this.firstFailureTime = Date.now();
6235
+ try {
6236
+ if (this.disabled || !this.runId) return;
6237
+ if (!this.firstTestStartTime && result.startTime) {
6238
+ this.firstTestStartTime = result.startTime.getTime();
6239
+ }
6240
+ if (!this.firstFailureTime && (result.status === "failed" || result.status === "timedOut")) {
6241
+ this.firstFailureTime = Date.now();
6242
+ }
6243
+ const promise = this.uploadLimit(
6244
+ () => this.processTestResult(test, result)
6245
+ );
6246
+ this.uploadQueue.push(promise);
6247
+ } catch (error) {
6248
+ logWarn(`Supatest reporter error in onTestEnd: ${getErrorMessage2(error)}`);
6221
6249
  }
6222
- const promise = this.uploadLimit(
6223
- () => this.processTestResult(test, result)
6224
- );
6225
- this.uploadQueue.push(promise);
6226
6250
  }
6227
6251
  async onEnd(result) {
6252
+ try {
6253
+ await this._onEnd(result);
6254
+ } catch (error) {
6255
+ logWarn(`Supatest reporter error in onEnd: ${getErrorMessage2(error)}`);
6256
+ }
6257
+ }
6258
+ async _onEnd(result) {
6228
6259
  if (this.disabled || !this.runId) {
6229
6260
  if (this.disabled && this.errorCollector.hasErrors()) {
6230
6261
  console.log(this.errorCollector.formatSummary());
@@ -6239,16 +6270,16 @@ var SupatestPlaywrightReporter = class {
6239
6270
  const startTime = this.startedAt ? new Date(this.startedAt).getTime() : 0;
6240
6271
  try {
6241
6272
  await this.client.completeRun(this.runId, {
6242
- status: this.mapRunStatus(result.status),
6273
+ status: this.mapRunStatus(result?.status),
6243
6274
  endedAt,
6244
6275
  summary,
6245
6276
  timing: {
6246
- totalDurationMs: Math.round(result.duration),
6277
+ totalDurationMs: Math.round(result?.duration ?? 0),
6247
6278
  timeToFirstTest: this.firstTestStartTime ? Math.round(this.firstTestStartTime - startTime) : void 0,
6248
6279
  timeToFirstFailure: this.firstFailureTime ? Math.round(this.firstFailureTime - startTime) : void 0
6249
6280
  }
6250
6281
  });
6251
- logInfo(`Run ${this.runId} completed: ${result.status}`);
6282
+ logInfo(`Run ${this.runId} completed: ${result?.status}`);
6252
6283
  } catch (error) {
6253
6284
  const errorMsg = getErrorMessage2(error);
6254
6285
  this.errorCollector.recordError("RUN_COMPLETE", errorMsg, { error });
@@ -6387,7 +6418,7 @@ var SupatestPlaywrightReporter = class {
6387
6418
  serializeAttachmentMeta(attachments) {
6388
6419
  return attachments.filter((a) => a.path || a.body).map((a) => ({
6389
6420
  name: a.name,
6390
- filename: a.path ? import_node_path2.default.basename(a.path) : a.name,
6421
+ filename: a.path ? import_node_path.default.basename(a.path) : a.name,
6391
6422
  contentType: a.contentType,
6392
6423
  sizeBytes: this.getAttachmentSize(a),
6393
6424
  kind: this.getAttachmentKind(a.name, a.contentType)
@@ -6433,7 +6464,7 @@ var SupatestPlaywrightReporter = class {
6433
6464
  }
6434
6465
  const meta = validAttachments.map((a) => ({
6435
6466
  name: a.name,
6436
- filename: import_node_path2.default.basename(a.path),
6467
+ filename: import_node_path.default.basename(a.path),
6437
6468
  contentType: a.contentType,
6438
6469
  sizeBytes: getFileSize(a.path),
6439
6470
  kind: this.getAttachmentKind(a.name, a.contentType)
@@ -6551,7 +6582,7 @@ var SupatestPlaywrightReporter = class {
6551
6582
  skipped,
6552
6583
  timedOut,
6553
6584
  interrupted,
6554
- durationMs: Math.round(result.duration),
6585
+ durationMs: Math.round(result?.duration ?? 0),
6555
6586
  expected,
6556
6587
  unexpected
6557
6588
  };