datagrok-tools 4.10.0 → 4.10.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.
@@ -12,7 +12,7 @@ var HELP_CONFIG = "\nUsage: grok config\n\nCreate or update a configuration file
12
12
  var HELP_CREATE = "\nUsage: grok create [name]\n\nCreate a package:\n\ngrok create Create a package in the current working directory\ngrok create <name> Create a package in a folder with the specified name\n\nPlease note that the package name may only include letters, numbers, underscores, or hyphens\n\nOptions:\n[--eslint] [--ide] [--js | --ts] [--test]\n\n--eslint Add a configuration for eslint\n--ide Add an IDE-specific configuration for debugging (vscode)\n--js Create a JavaScript package\n--ts Create a TypeScript package (default)\n--test Add tests support (TypeScript packages only)\n";
13
13
  var HELP_PUBLISH = "\nUsage: grok publish [host]\n\nUpload a package\n\nOptions:\n[--build|--rebuild] [--debug|--release] [-k | --key] [--suffix]\n\nRunning `grok publish` is the same as running `grok publish defaultHost --build --debug`\n";
14
14
  var HELP_CHECK = "\nUsage: grok check\n\nOptions:\n[-r | --recursive]\n\n--recursive Check all packages in the current directory\n\nCheck package content (function signatures, import statements of external modules, etc.)\n";
15
- var HELP_TEST = "\nUsage: grok test\n\nOptions:\n[--host] [--csv]\n\n--host Host alias as in the config file\n--csv Save the test report in a CSV file\n--gui Launch graphical interface (non-headless mode)\n--skip-build Skip the package build step\n--skip-publish Skip the package publication step\n\nRun package tests\n\nSee instructions:\nhttps://datagrok.ai/help/develop/how-to/test-packages#local-testing\n";
15
+ var HELP_TEST = "\nUsage: grok test\n\nOptions:\n[--category] [--host] [--csv] [--gui] [--skip-build] [--skip-publish]\n\n--category Specify a category name to run tests for\n--host Host alias as in the config file\n--csv Save the test report in a CSV file\n--gui Launch graphical interface (non-headless mode)\n--skip-build Skip the package build step\n--skip-publish Skip the package publication step\n\nRun package tests\n\nSee instructions:\nhttps://datagrok.ai/help/develop/how-to/test-packages#local-testing\n";
16
16
  var HELP_LINK = "\nUsage: grok link\n\nLink `datagrok-api` and libraries for local development\n\nOptions:\n[--local | --npm]\n\n--local Default. Links libraries and updates package scripts (\"link-all\", \"build-all\")\n--npm Unlinks local packages and runs `npm i`\n";
17
17
  var HELP_MIGRATE = "\nUsage: grok migrate\n\nSwitch to `grok` tools by copying your keys to the config\nfile and converting your scripts in the `package.json` file\n";
18
18
  var help = {
@@ -21,7 +21,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
21
21
  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; }
22
22
  function test(args) {
23
23
  var options = Object.keys(args).slice(1);
24
- var commandOptions = ['host', 'csv', 'gui', 'skip-build', 'skip-publish'];
24
+ var commandOptions = ['host', 'csv', 'gui', 'skip-build', 'skip-publish', 'category'];
25
25
  var nArgs = args['_'].length;
26
26
  var curDir = process.cwd();
27
27
  var grokDir = _path["default"].join(_os["default"].homedir(), '.grok');
@@ -128,6 +128,7 @@ function test(args) {
128
128
  })));
129
129
  }
130
130
  function runTest(timeout) {
131
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
131
132
  return testUtils.runWithTimeout(timeout, /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
132
133
  var _process$env$TARGET_P;
133
134
  var targetPackage, r;
@@ -138,16 +139,17 @@ function test(args) {
138
139
  targetPackage = (_process$env$TARGET_P = process.env.TARGET_PACKAGE) !== null && _process$env$TARGET_P !== void 0 ? _process$env$TARGET_P : '#{PACKAGE_NAMESPACE}';
139
140
  console.log("Testing ".concat(targetPackage, " package...\n"));
140
141
  _context2.next = 4;
141
- return page.evaluate(function (targetPackage) {
142
+ return page.evaluate(function (targetPackage, options) {
142
143
  return new Promise(function (resolve, reject) {
143
- window.grok.functions.eval(targetPackage + ':test()').then(function (df) {
144
+ var testCall = "".concat(targetPackage, ":test(").concat(options.category ? "category=\"".concat(options.category, "\"") : '', ")");
145
+ window.grok.functions.eval(testCall).then(function (df) {
144
146
  var failed = false;
145
147
  var skipReport = '';
146
148
  var passReport = '';
147
149
  var failReport = '';
148
150
  if (df == null) {
149
151
  failed = true;
150
- failReport = 'Fail reason: No package tests found';
152
+ failReport = "Fail reason: No package tests found".concat(options.category ? " for category \"".concat(options.category, "\"") : '');
151
153
  resolve({
152
154
  failReport: failReport,
153
155
  skipReport: skipReport,
@@ -185,7 +187,7 @@ function test(args) {
185
187
  return reject(e);
186
188
  });
187
189
  });
188
- }, targetPackage);
190
+ }, targetPackage, options);
189
191
  case 4:
190
192
  r = _context2.sent;
191
193
  return _context2.abrupt("return", r);
@@ -217,7 +219,9 @@ function test(args) {
217
219
  throw _context3.t0;
218
220
  case 10:
219
221
  _context3.next = 12;
220
- return runTest(7200000);
222
+ return runTest(7200000, {
223
+ category: args.category
224
+ });
221
225
  case 12:
222
226
  r = _context3.sent;
223
227
  if (r.csv && args.csv) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datagrok-tools",
3
- "version": "4.10.0",
3
+ "version": "4.10.2",
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": {