datagrok-tools 4.13.45 → 4.13.47

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.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Datagrok-tools changelog
2
2
 
3
+ ## 4.13.47 (2024-12-25)
4
+
5
+ ### Features
6
+
7
+ * Fixed category selection for test
8
+
9
+ ## 4.13.46 (2024-12-23)
10
+
11
+ ### Features
12
+
13
+ * Improved error handling:
14
+ - Different exit codes for package errors / grok script errors
15
+ - Graceful error handling when testing non-existing packages
3
16
 
4
17
  ## 4.13.45 (2024-12-12)
5
18
 
@@ -68,7 +68,7 @@ function _test() {
68
68
  res = _context.sent;
69
69
  if (args.csv) (0, _testUtils.saveCsvResults)([res.csv], csvReportDir);
70
70
  (0, _testUtils.printWorkersResult)(res, args.verbose);
71
- if (!res) testUtils.exitWithCode(1);else testUtils.exitWithCode(0);
71
+ if (res.failed) testUtils.exitWithCode(1);else testUtils.exitWithCode(0);
72
72
  return _context.abrupt("return", true);
73
73
  case 20:
74
74
  case "end":
@@ -90,8 +90,8 @@ function runTesting(_x2) {
90
90
  }
91
91
  function _runTesting() {
92
92
  _runTesting = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(args) {
93
- var _process$env$TARGET_P;
94
- var testsObj, parsed, organized, filtered, _iterator, _step, element, testsResults, r, workerId;
93
+ var _process$env$TARGET_P, _args$category;
94
+ var testsObj, parsed, organized, filtered, categoryRegex, _iterator, _step, element, testsResults, r, workerId;
95
95
  return _regenerator["default"].wrap(function _callee3$(_context3) {
96
96
  while (1) switch (_context3.prev = _context3.next) {
97
97
  case 0:
@@ -100,8 +100,22 @@ function _runTesting() {
100
100
  return (0, _testUtils.loadTestsList)([(_process$env$TARGET_P = process.env.TARGET_PACKAGE) !== null && _process$env$TARGET_P !== void 0 ? _process$env$TARGET_P : ''], args.core);
101
101
  case 3:
102
102
  testsObj = _context3.sent;
103
- console.log(testsObj);
104
103
  parsed = (0, _orderFunctions.setAlphabeticalOrder)(testsObj, 1, 1);
104
+ if (!(parsed.length == 0)) {
105
+ _context3.next = 7;
106
+ break;
107
+ }
108
+ return _context3.abrupt("return", {
109
+ failed: true,
110
+ verbosePassed: 'Package not found',
111
+ verboseSkipped: 'Package not found',
112
+ verboseFailed: 'Package not found',
113
+ passedAmount: 0,
114
+ skippedAmount: 0,
115
+ failedAmount: 0,
116
+ csv: ''
117
+ });
118
+ case 7:
105
119
  organized = parsed[0].map(function (testObj) {
106
120
  return {
107
121
  "package": testObj.packageName,
@@ -116,12 +130,13 @@ function _runTesting() {
116
130
  };
117
131
  });
118
132
  filtered = [];
133
+ categoryRegex = new RegExp("".concat((_args$category = args.category) === null || _args$category === void 0 ? void 0 : _args$category.replaceAll(' ', ''), ".*"));
119
134
  if (args.category) {
120
135
  _iterator = _createForOfIteratorHelper(organized);
121
136
  try {
122
137
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
123
138
  element = _step.value;
124
- if (element.params.category === args.category) {
139
+ if (categoryRegex.test(element.params.category.replaceAll(' ', ''))) {
125
140
  if (element.params.test === args.test || !args.test) filtered.push(element);
126
141
  }
127
142
  }
@@ -132,10 +147,14 @@ function _runTesting() {
132
147
  }
133
148
  organized = filtered;
134
149
  }
150
+ if (args.verbose) {
151
+ console.log(filtered);
152
+ console.log("Tests total: ".concat(filtered.length));
153
+ }
135
154
  color.info('Starting tests...');
136
155
  testsResults = [];
137
156
  workerId = 1;
138
- _context3.next = 14;
157
+ _context3.next = 17;
139
158
  return (0, _testUtils.timeout)( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
140
159
  var _args$benchmark, _args$catchUnhandled, _args$gui, _args$record, _args$report, _args$verbose, _args$ciCd, testsLeft, testsToReproduce, _iterator2, _step2, testData, reproduced, _iterator3, _step3, _test2, _reproducedTest2;
141
160
  return _regenerator["default"].wrap(function _callee2$(_context2) {
@@ -225,12 +244,12 @@ function _runTesting() {
225
244
  }
226
245
  }, _callee2, null, [[12, 25, 28, 31]]);
227
246
  })), testInvocationTimeout);
228
- case 14:
229
- _context3.next = 16;
247
+ case 17:
248
+ _context3.next = 19;
230
249
  return (0, _testUtils.mergeWorkersResults)(testsResults);
231
- case 16:
250
+ case 19:
232
251
  return _context3.abrupt("return", _context3.sent);
233
- case 17:
252
+ case 20:
234
253
  case "end":
235
254
  return _context3.stop();
236
255
  }
package/bin/grok.js CHANGED
@@ -31,7 +31,7 @@ if (command in commands) {
31
31
  } catch (err) {
32
32
  console.error(err);
33
33
  console.log(help[command]);
34
- exitWithCode(1);
34
+ exitWithCode(255);
35
35
  }
36
36
  } else
37
37
  console.log(help.help);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datagrok-tools",
3
- "version": "4.13.45",
3
+ "version": "4.13.47",
4
4
  "description": "Utility to upload and publish packages to Datagrok",
5
5
  "homepage": "https://github.com/datagrok-ai/public/tree/master/tools#readme",
6
6
  "dependencies": {