@bigbinary/neeto-playwright-reporter 1.5.2 → 1.5.3

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/index.cjs.js CHANGED
@@ -809,10 +809,233 @@ function _includes(a, list) {
809
809
  return _indexOf(list, a, 0) >= 0;
810
810
  }
811
811
 
812
+ function _map(fn, functor) {
813
+ var idx = 0;
814
+ var len = functor.length;
815
+ var result = Array(len);
816
+
817
+ while (idx < len) {
818
+ result[idx] = fn(functor[idx]);
819
+ idx += 1;
820
+ }
821
+
822
+ return result;
823
+ }
824
+
825
+ function _arrayReduce(reducer, acc, list) {
826
+ var index = 0;
827
+ var length = list.length;
828
+
829
+ while (index < length) {
830
+ acc = reducer(acc, list[index]);
831
+ index += 1;
832
+ }
833
+
834
+ return acc;
835
+ }
836
+
812
837
  function _isObject(x) {
813
838
  return Object.prototype.toString.call(x) === '[object Object]';
814
839
  }
815
840
 
841
+ var XMap =
842
+ /*#__PURE__*/
843
+ function () {
844
+ function XMap(f, xf) {
845
+ this.xf = xf;
846
+ this.f = f;
847
+ }
848
+
849
+ XMap.prototype['@@transducer/init'] = _xfBase.init;
850
+ XMap.prototype['@@transducer/result'] = _xfBase.result;
851
+
852
+ XMap.prototype['@@transducer/step'] = function (result, input) {
853
+ return this.xf['@@transducer/step'](result, this.f(input));
854
+ };
855
+
856
+ return XMap;
857
+ }();
858
+
859
+ var _xmap = function _xmap(f) {
860
+ return function (xf) {
861
+ return new XMap(f, xf);
862
+ };
863
+ };
864
+
865
+ /**
866
+ * Takes a function and
867
+ * a [functor](https://github.com/fantasyland/fantasy-land#functor),
868
+ * applies the function to each of the functor's values, and returns
869
+ * a functor of the same shape.
870
+ *
871
+ * Ramda provides suitable `map` implementations for `Array` and `Object`,
872
+ * so this function may be applied to `[1, 2, 3]` or `{x: 1, y: 2, z: 3}`.
873
+ *
874
+ * Dispatches to the `map` method of the second argument, if present.
875
+ *
876
+ * Acts as a transducer if a transformer is given in list position.
877
+ *
878
+ * Also treats functions as functors and will compose them together.
879
+ *
880
+ * @func
881
+ * @memberOf R
882
+ * @since v0.1.0
883
+ * @category List
884
+ * @sig Functor f => (a -> b) -> f a -> f b
885
+ * @param {Function} fn The function to be called on every element of the input `list`.
886
+ * @param {Array} list The list to be iterated over.
887
+ * @return {Array} The new list.
888
+ * @see R.transduce, R.addIndex, R.pluck, R.project
889
+ * @example
890
+ *
891
+ * const double = x => x * 2;
892
+ *
893
+ * R.map(double, [1, 2, 3]); //=> [2, 4, 6]
894
+ *
895
+ * R.map(double, {x: 1, y: 2, z: 3}); //=> {x: 2, y: 4, z: 6}
896
+ * @symb R.map(f, [a, b]) = [f(a), f(b)]
897
+ * @symb R.map(f, { x: a, y: b }) = { x: f(a), y: f(b) }
898
+ * @symb R.map(f, functor_o) = functor_o.map(f)
899
+ */
900
+
901
+ var map =
902
+ /*#__PURE__*/
903
+ _curry2(
904
+ /*#__PURE__*/
905
+ _dispatchable(['fantasy-land/map', 'map'], _xmap, function map(fn, functor) {
906
+ switch (Object.prototype.toString.call(functor)) {
907
+ case '[object Function]':
908
+ return curryN(functor.length, function () {
909
+ return fn.call(this, functor.apply(this, arguments));
910
+ });
911
+
912
+ case '[object Object]':
913
+ return _arrayReduce(function (acc, key) {
914
+ acc[key] = fn(functor[key]);
915
+ return acc;
916
+ }, {}, keys(functor));
917
+
918
+ default:
919
+ return _map(fn, functor);
920
+ }
921
+ }));
922
+
923
+ /**
924
+ * Determine if the passed argument is an integer.
925
+ *
926
+ * @private
927
+ * @param {*} n
928
+ * @category Type
929
+ * @return {Boolean}
930
+ */
931
+ var _isInteger = Number.isInteger || function _isInteger(n) {
932
+ return n << 0 === n;
933
+ };
934
+
935
+ function _isString(x) {
936
+ return Object.prototype.toString.call(x) === '[object String]';
937
+ }
938
+
939
+ /**
940
+ * Returns the nth element of the given list or string. If n is negative the
941
+ * element at index length + n is returned.
942
+ *
943
+ * @func
944
+ * @memberOf R
945
+ * @since v0.1.0
946
+ * @category List
947
+ * @sig Number -> [a] -> a | Undefined
948
+ * @sig Number -> String -> String
949
+ * @param {Number} offset
950
+ * @param {*} list
951
+ * @return {*}
952
+ * @example
953
+ *
954
+ * const list = ['foo', 'bar', 'baz', 'quux'];
955
+ * R.nth(1, list); //=> 'bar'
956
+ * R.nth(-1, list); //=> 'quux'
957
+ * R.nth(-99, list); //=> undefined
958
+ *
959
+ * R.nth(2, 'abc'); //=> 'c'
960
+ * R.nth(3, 'abc'); //=> ''
961
+ * @symb R.nth(-1, [a, b, c]) = c
962
+ * @symb R.nth(0, [a, b, c]) = a
963
+ * @symb R.nth(1, [a, b, c]) = b
964
+ */
965
+
966
+ var nth =
967
+ /*#__PURE__*/
968
+ _curry2(function nth(offset, list) {
969
+ var idx = offset < 0 ? list.length + offset : offset;
970
+ return _isString(list) ? list.charAt(idx) : list[idx];
971
+ });
972
+
973
+ /**
974
+ * Returns a function that when supplied an object returns the indicated
975
+ * property of that object, if it exists.
976
+ *
977
+ * @func
978
+ * @memberOf R
979
+ * @since v0.1.0
980
+ * @category Object
981
+ * @typedefn Idx = String | Int | Symbol
982
+ * @sig Idx -> {s: a} -> a | Undefined
983
+ * @param {String|Number} p The property name or array index
984
+ * @param {Object} obj The object to query
985
+ * @return {*} The value at `obj.p`.
986
+ * @see R.path, R.props, R.pluck, R.project, R.nth
987
+ * @example
988
+ *
989
+ * R.prop('x', {x: 100}); //=> 100
990
+ * R.prop('x', {}); //=> undefined
991
+ * R.prop(0, [100]); //=> 100
992
+ * R.compose(R.inc, R.prop('x'))({ x: 3 }) //=> 4
993
+ */
994
+
995
+ var prop =
996
+ /*#__PURE__*/
997
+ _curry2(function prop(p, obj) {
998
+ if (obj == null) {
999
+ return;
1000
+ }
1001
+
1002
+ return _isInteger(p) ? nth(p, obj) : obj[p];
1003
+ });
1004
+
1005
+ /**
1006
+ * Returns a new list by plucking the same named property off all objects in
1007
+ * the list supplied.
1008
+ *
1009
+ * `pluck` will work on
1010
+ * any [functor](https://github.com/fantasyland/fantasy-land#functor) in
1011
+ * addition to arrays, as it is equivalent to `R.map(R.prop(k), f)`.
1012
+ *
1013
+ * @func
1014
+ * @memberOf R
1015
+ * @since v0.1.0
1016
+ * @category List
1017
+ * @sig Functor f => k -> f {k: v} -> f v
1018
+ * @param {Number|String} key The key name to pluck off of each object.
1019
+ * @param {Array} f The array or functor to consider.
1020
+ * @return {Array} The list of values for the given key.
1021
+ * @see R.project, R.prop, R.props
1022
+ * @example
1023
+ *
1024
+ * var getAges = R.pluck('age');
1025
+ * getAges([{name: 'fred', age: 29}, {name: 'wilma', age: 27}]); //=> [29, 27]
1026
+ *
1027
+ * R.pluck(0, [[1, 2], [3, 4]]); //=> [1, 3]
1028
+ * R.pluck('val', {a: {val: 3}, b: {val: 5}}); //=> {a: 3, b: 5}
1029
+ * @symb R.pluck('x', [{x: 1, y: 2}, {x: 3, y: 4}, {x: 5, y: 6}]) = [1, 3, 5]
1030
+ * @symb R.pluck(0, [[1, 2], [3, 4], [5, 6]]) = [1, 3, 5]
1031
+ */
1032
+
1033
+ var pluck =
1034
+ /*#__PURE__*/
1035
+ _curry2(function pluck(p, list) {
1036
+ return map(prop(p), list);
1037
+ });
1038
+
816
1039
  /**
817
1040
  * Checks if the input value is `null` or `undefined`.
818
1041
  *
@@ -21226,6 +21449,10 @@ const onBegin = async (self, config, rootSuite) => {
21226
21449
  let attempts = {};
21227
21450
  self.totalTestCount = rootSuite.allTests().length;
21228
21451
  self.rootDir = config.rootDir;
21452
+ if (self.totalTestCount === 0) {
21453
+ consoleLogFormatted.error(ERRORS.onBegin.noTestsToReport);
21454
+ return;
21455
+ }
21229
21456
  try {
21230
21457
  const runDetails = {
21231
21458
  commitId: getCurrentCommitSha(),
@@ -21239,10 +21466,6 @@ const onBegin = async (self, config, rootSuite) => {
21239
21466
  };
21240
21467
  await runsApi.create(runDetails);
21241
21468
  self.hasRunStarted = true;
21242
- if (self.totalTestCount === 0) {
21243
- consoleLogFormatted.error(ERRORS.onBegin.noTestsToReport);
21244
- return;
21245
- }
21246
21469
  ({ data: attempts } = await testEntitiesApi.create(self.ciBuildId, {
21247
21470
  testEntities: getInitializerData(config, rootSuite),
21248
21471
  shard: currentShard,
@@ -21299,7 +21522,7 @@ const onTestBegin = async (self, test, { retry }) => {
21299
21522
  const { title, repeatEachIndex } = test;
21300
21523
  const { rootDir, currentShard, ciBuildId } = self;
21301
21524
  const { historyId } = getTestData(test, rootDir);
21302
- const startedAt = new Date();
21525
+ const startedAt = new Date().toString();
21303
21526
  const attemptIndex = joinHyphenCase(retry, repeatEachIndex);
21304
21527
  self.unreportedAttemptCount++;
21305
21528
  consoleLogFormatted.invertBackground(MESSAGES.onTestBegin.startingTest(title, historyId));
@@ -21307,7 +21530,7 @@ const onTestBegin = async (self, test, { retry }) => {
21307
21530
  await waitUntilCondition(() => { var _a, _b; return (_b = (_a = self.attempts) === null || _a === void 0 ? void 0 : _a[historyId]) === null || _b === void 0 ? void 0 : _b[FIRST_ATTEMPT_INDEX]; });
21308
21531
  const attemptsPayload = {
21309
21532
  status: "running",
21310
- startedAt: startedAt.toString(),
21533
+ startedAt,
21311
21534
  shard: currentShard,
21312
21535
  repeatEachIndex,
21313
21536
  };
@@ -21315,7 +21538,7 @@ const onTestBegin = async (self, test, { retry }) => {
21315
21538
  await attemptsApi.update(ciBuildId, historyId, self.attempts[historyId][FIRST_ATTEMPT_INDEX], attemptsPayload);
21316
21539
  }
21317
21540
  else {
21318
- const { data: { attemptId: attemptId }, } = await attemptsApi.create(ciBuildId, historyId, attemptsPayload);
21541
+ const { data: { attemptId }, } = await attemptsApi.create(ciBuildId, historyId, attemptsPayload);
21319
21542
  self.attempts = mergeDeepRight(self.attempts, {
21320
21543
  [historyId]: { [attemptIndex]: attemptId },
21321
21544
  });
@@ -22706,15 +22929,22 @@ const onTestEnd = async (self, testCase, { status, duration, errors, error, retr
22706
22929
  errorSnippet: error && generateErrorReport(error),
22707
22930
  };
22708
22931
  consoleLogFormatted.underline(title);
22709
- const bars = await Promise.all(attachments.map(async ({ name, path, body, contentType }) => {
22932
+ const files = attachments
22933
+ .map(({ name, path, body, contentType }) => {
22710
22934
  if (VALID_ASSET_TYPES.includes(name)) {
22711
22935
  const buffer = path ? require$$6.readFileSync(path) : body;
22712
22936
  const fileName = generateFileName(path, name, contentType);
22713
22937
  const { file, ...metadata } = getFileData(buffer, contentType, fileName);
22714
- const { data: { signedId, directUpload: directUploadMetaData }, } = await getDirectUploadURL(metadata);
22715
- testResult[`${name}s`].push(signedId);
22716
- return uploadToS3(file, directUploadMetaData, `${title} - ${name}`);
22938
+ return { file, metadata, name };
22717
22939
  }
22940
+ })
22941
+ .filter((fileData) => fileData !== undefined);
22942
+ const payload = { metadata: pluck("metadata", files) };
22943
+ const { data: directUploadResponses } = await getDirectUploadURL(payload);
22944
+ const bars = await Promise.all(directUploadResponses.map(async ({ signedId, directUpload }, index) => {
22945
+ var _a, _b;
22946
+ testResult[`${(_a = files[index]) === null || _a === void 0 ? void 0 : _a.name}s`].push(signedId);
22947
+ return uploadToS3(files[index].file, directUpload, `${title} - ${(_b = files[index]) === null || _b === void 0 ? void 0 : _b.name}`);
22718
22948
  }));
22719
22949
  self.progressBars.push(...bars);
22720
22950
  await waitUntilCondition(() => self.attempts[historyId][attemptIndex]);