datagrok-tools 4.12.3 → 4.12.4

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/README.md CHANGED
@@ -118,4 +118,19 @@ Read more about package development in [Datagrok's documentation](https://datagr
118
118
  save a test run result, add the `--csv` flag (the report will be saved in a
119
119
  CSV file in the package folder). You can find more details in [local package testing
120
120
  instructions](https://datagrok.ai/help/develop/how-to/test-packages#local-testing).
121
+
122
+ Table with all available flags:
123
+ | Flag | Description |
124
+ |----------------|---------------------------------------------------------------------------|
125
+ | catchUnhandled | Whether or not to catch unhandled exceptions during tests |
126
+ | category | Runs tests of a specific category |
127
+ | csv | Saves tests run results as a CSV file in the package folder |
128
+ | gui | Disables the headless browser mode |
129
+ | host | Specify server alias |
130
+ | record | Records the test execution process in mp4 format |
131
+ | report | Sends a report on test results |
132
+ | skip-build | Skips package build step |
133
+ | skip-publish | Skips package publish step |
134
+ | verbose | Prints detailed information about passed and skipped tests in the console |
135
+
121
136
  - `link` command is used for public plugins development to link `datagrok-api` and libraries.
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.check = check;
9
+ exports.checkChangelog = checkChangelog;
9
10
  exports.checkFuncSignatures = checkFuncSignatures;
10
11
  exports.checkImportStatements = checkImportStatements;
11
12
  exports.checkPackageFile = checkPackageFile;
@@ -85,6 +86,7 @@ function check(args) {
85
86
  isWebpack: isWebpack,
86
87
  externals: externals
87
88
  })));
89
+ warnings.push.apply(warnings, (0, _toConsumableArray2["default"])(checkChangelog(packagePath)));
88
90
  if (warnings.length) {
89
91
  console.log("Checking package ".concat(_path["default"].basename(packagePath), "..."));
90
92
  warn(warnings);
@@ -398,6 +400,34 @@ function checkPackageFile(packagePath, options) {
398
400
  }
399
401
  return warnings;
400
402
  }
403
+ function checkChangelog(packagePath) {
404
+ var warnings = [];
405
+ var clf;
406
+ try {
407
+ clf = _fs["default"].readFileSync(_path["default"].join(packagePath, 'CHANGELOG.md'), {
408
+ encoding: 'utf-8'
409
+ });
410
+ } catch (e) {
411
+ return ['CHANGELOG.md file does not exist'];
412
+ }
413
+ var regex = /^##[^#].*$/gm;
414
+ var h2 = clf.match(regex);
415
+ if (!h2) return ['No versions found in CHANGELOG.md'];
416
+ regex = /^## \d+\.\d+\.\d+ \(\d{4}-\d{2}-\d{2}\).*$/;
417
+ var _iterator7 = _createForOfIteratorHelper(h2),
418
+ _step7;
419
+ try {
420
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
421
+ var h = _step7.value;
422
+ if (!regex.test(h)) warnings.push("CHANGELOG: '".concat(h, "' does not match the h2 format"));
423
+ }
424
+ } catch (err) {
425
+ _iterator7.e(err);
426
+ } finally {
427
+ _iterator7.f();
428
+ }
429
+ return warnings;
430
+ }
401
431
  function warn(warnings) {
402
432
  warnings.forEach(function (w) {
403
433
  return color.warn(w);
@@ -411,11 +441,11 @@ function getFuncMetadata(script) {
411
441
  inputs: [],
412
442
  outputs: []
413
443
  };
414
- var _iterator7 = _createForOfIteratorHelper(script.split('\n')),
415
- _step7;
444
+ var _iterator8 = _createForOfIteratorHelper(script.split('\n')),
445
+ _step8;
416
446
  try {
417
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
418
- var line = _step7.value;
447
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
448
+ var line = _step8.value;
419
449
  if (!line) continue;
420
450
  var match = line.match(utils.paramRegex);
421
451
  if (match) {
@@ -444,9 +474,9 @@ function getFuncMetadata(script) {
444
474
  }
445
475
  }
446
476
  } catch (err) {
447
- _iterator7.e(err);
477
+ _iterator8.e(err);
448
478
  } finally {
449
- _iterator7.f();
479
+ _iterator8.f();
450
480
  }
451
481
  return funcData;
452
482
  }
@@ -22,7 +22,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
22
22
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
23
  function test(args) {
24
24
  var options = Object.keys(args).slice(1);
25
- var commandOptions = ['host', 'csv', 'gui', 'catchUnhandled', 'report', 'skip-build', 'skip-publish', 'category', 'record'];
25
+ var commandOptions = ['host', 'csv', 'gui', 'catchUnhandled', 'report', 'skip-build', 'skip-publish', 'category', 'record', 'verbose'];
26
26
  var nArgs = args['_'].length;
27
27
  var curDir = process.cwd();
28
28
  var grokDir = _path["default"].join(_os["default"].homedir(), '.grok');
@@ -170,6 +170,10 @@ function test(args) {
170
170
  var skipReport = '';
171
171
  var passReport = '';
172
172
  var failReport = '';
173
+ var countReport = {
174
+ skip: 0,
175
+ pass: 0
176
+ };
173
177
  if (df == null) {
174
178
  failed = true;
175
179
  failReport = "Fail reason: No package tests found".concat(options.category ? " for category \"".concat(options.category, "\"") : '');
@@ -177,7 +181,8 @@ function test(args) {
177
181
  failReport: failReport,
178
182
  skipReport: skipReport,
179
183
  passReport: passReport,
180
- failed: failed
184
+ failed: failed,
185
+ countReport: countReport
181
186
  });
182
187
  }
183
188
  var cStatus = df.columns.byName('success');
@@ -190,8 +195,10 @@ function test(args) {
190
195
  if (cStatus.get(i)) {
191
196
  if (cSkipped.get(i)) {
192
197
  skipReport += "Test result : Skipped : ".concat(cTime.get(i), " : ").concat(targetPackage, ".").concat(cCat.get(i), ".").concat(cName.get(i), " : ").concat(cMessage.get(i), "\n");
198
+ countReport.skip += 1;
193
199
  } else {
194
200
  passReport += "Test result : Success : ".concat(cTime.get(i), " : ").concat(targetPackage, ".").concat(cCat.get(i), ".").concat(cName.get(i), " : ").concat(cMessage.get(i), "\n");
201
+ countReport.pass += 1;
195
202
  }
196
203
  } else {
197
204
  failed = true;
@@ -204,7 +211,8 @@ function test(args) {
204
211
  skipReport: skipReport,
205
212
  passReport: passReport,
206
213
  failed: failed,
207
- csv: csv
214
+ csv: csv,
215
+ countReport: countReport
208
216
  });
209
217
  })["catch"](function (e) {
210
218
  return reject(e);
@@ -263,8 +271,8 @@ function test(args) {
263
271
  _fs["default"].writeFileSync(_path["default"].join(curDir, 'test-report.csv'), r.csv, 'utf8');
264
272
  color.info('Saved `test-report.csv`\n');
265
273
  }
266
- if (r.passReport) console.log(r.passReport);
267
- if (r.skipReport) console.log(r.skipReport);
274
+ if (r.passReport && args.verbose) console.log(r.passReport);else console.log('Passed tests: ' + r.countReport.pass);
275
+ if (r.skipReport && args.verbose) console.log(r.skipReport);else console.log('Skipped tests: ' + r.countReport.skip);
268
276
  if (r.failed) {
269
277
  console.log(r.failReport);
270
278
  color.fail('Tests failed.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datagrok-tools",
3
- "version": "4.12.3",
3
+ "version": "4.12.4",
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": {