datagrok-tools 4.10.4 → 4.11.0
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/bin/commands/help.js +1 -1
- package/bin/commands/test.js +10 -6
- package/bin/utils/test-utils.js +14 -3
- package/package-template/package.json +1 -0
- package/package.json +3 -3
package/bin/commands/help.js
CHANGED
|
@@ -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[--category] [--host] [--csv] [--gui] [--skip-build] [--skip-publish]\n\n--category
|
|
15
|
+
var HELP_TEST = "\nUsage: grok test\n\nOptions:\n[--category] [--host] [--csv] [--gui] [--skip-build] [--skip-publish] [--catchUnhandled] [--report]\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--catchUnhandled Catch unhandled exceptions during test execution (default=true)\n--report Report failed tests to audit, notifies package author (default=false)\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 = {
|
package/bin/commands/test.js
CHANGED
|
@@ -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', 'category'];
|
|
24
|
+
var commandOptions = ['host', 'csv', 'gui', 'catchUnhandled', 'report', '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');
|
|
@@ -139,10 +139,12 @@ function test(args) {
|
|
|
139
139
|
targetPackage = (_process$env$TARGET_P = process.env.TARGET_PACKAGE) !== null && _process$env$TARGET_P !== void 0 ? _process$env$TARGET_P : '#{PACKAGE_NAMESPACE}';
|
|
140
140
|
console.log("Testing ".concat(targetPackage, " package...\n"));
|
|
141
141
|
_context2.next = 4;
|
|
142
|
-
return page.evaluate(function (targetPackage, options) {
|
|
142
|
+
return page.evaluate(function (targetPackage, options, testContext) {
|
|
143
143
|
return new Promise(function (resolve, reject) {
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
window.grok.functions.call("".concat(targetPackage, ":test"), {
|
|
145
|
+
'category': options.category,
|
|
146
|
+
'testContext': testContext
|
|
147
|
+
}).then(function (df) {
|
|
146
148
|
var failed = false;
|
|
147
149
|
var skipReport = '';
|
|
148
150
|
var passReport = '';
|
|
@@ -187,7 +189,7 @@ function test(args) {
|
|
|
187
189
|
return reject(e);
|
|
188
190
|
});
|
|
189
191
|
});
|
|
190
|
-
}, targetPackage, options);
|
|
192
|
+
}, targetPackage, options, new testUtils.TestContext(options.catchUnhandled, options.report));
|
|
191
193
|
case 4:
|
|
192
194
|
r = _context2.sent;
|
|
193
195
|
return _context2.abrupt("return", r);
|
|
@@ -220,7 +222,9 @@ function test(args) {
|
|
|
220
222
|
case 10:
|
|
221
223
|
_context3.next = 12;
|
|
222
224
|
return runTest(7200000, {
|
|
223
|
-
category: args.category
|
|
225
|
+
category: args.category,
|
|
226
|
+
catchUnhandled: args.catchUnhandled,
|
|
227
|
+
report: args.report
|
|
224
228
|
});
|
|
225
229
|
case 12:
|
|
226
230
|
r = _context3.sent;
|
package/bin/utils/test-utils.js
CHANGED
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.defaultLaunchParameters = void 0;
|
|
8
|
+
exports.defaultLaunchParameters = exports.TestContext = void 0;
|
|
9
9
|
exports.exitWithCode = exitWithCode;
|
|
10
10
|
exports.getBrowserPage = getBrowserPage;
|
|
11
11
|
exports.getDevKey = getDevKey;
|
|
@@ -13,6 +13,8 @@ exports.getToken = getToken;
|
|
|
13
13
|
exports.getWebUrl = getWebUrl;
|
|
14
14
|
exports.runWithTimeout = runWithTimeout;
|
|
15
15
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
16
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
18
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
17
19
|
var _fs = _interopRequireDefault(require("fs"));
|
|
18
20
|
var _os = _interopRequireDefault(require("os"));
|
|
@@ -26,7 +28,8 @@ var grokDir = _path["default"].join(_os["default"].homedir(), '.grok');
|
|
|
26
28
|
var confPath = _path["default"].join(grokDir, 'config.yaml');
|
|
27
29
|
var defaultLaunchParameters = {
|
|
28
30
|
args: ['--disable-dev-shm-usage', '--disable-features=site-per-process'],
|
|
29
|
-
ignoreHTTPSErrors: true
|
|
31
|
+
ignoreHTTPSErrors: true,
|
|
32
|
+
headless: 'new'
|
|
30
33
|
};
|
|
31
34
|
exports.defaultLaunchParameters = defaultLaunchParameters;
|
|
32
35
|
function getToken(_x, _x2) {
|
|
@@ -245,4 +248,12 @@ function runWithTimeout(timeout, f) {
|
|
|
245
248
|
function exitWithCode(code) {
|
|
246
249
|
console.log("Exiting with code ".concat(code));
|
|
247
250
|
process.exit(code);
|
|
248
|
-
}
|
|
251
|
+
}
|
|
252
|
+
var TestContext = function TestContext(catchUnhandled, report) {
|
|
253
|
+
(0, _classCallCheck2["default"])(this, TestContext);
|
|
254
|
+
(0, _defineProperty2["default"])(this, "catchUnhandled", true);
|
|
255
|
+
(0, _defineProperty2["default"])(this, "report", false);
|
|
256
|
+
if (catchUnhandled !== undefined) this.catchUnhandled = catchUnhandled;
|
|
257
|
+
if (report !== undefined) this.report = report;
|
|
258
|
+
};
|
|
259
|
+
exports.TestContext = TestContext;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "datagrok-tools",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.11.0",
|
|
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": {
|
|
7
7
|
"@babel/parser": "^7.21.2",
|
|
8
|
-
"@babel/traverse": "^7.21.2",
|
|
9
8
|
"@babel/runtime": "^7.16.0",
|
|
9
|
+
"@babel/traverse": "^7.21.2",
|
|
10
10
|
"archiver": "^4.0.2",
|
|
11
11
|
"archiver-promise": "^1.0.0",
|
|
12
12
|
"fs": "latest",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"node-recursive-directory": "^1.2.0",
|
|
19
19
|
"os": "^0.1.1",
|
|
20
20
|
"path": "^0.12.7",
|
|
21
|
-
"puppeteer": "^
|
|
21
|
+
"puppeteer": "^20.3.0"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"link": "npm link",
|