datagrok-tools 4.13.38 → 4.13.40
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 +13 -0
- package/bin/commands/help.js +2 -2
- package/bin/commands/publish.js +54 -42
- package/bin/commands/test.js +135 -120
- package/bin/utils/test-utils.js +33 -32
- package/package-template/src/package-test.ts +2 -2
- package/package-template/src/package.js +4 -0
- package/package.json +1 -1
- package/package-template/src/global.d.ts +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
# Datagrok-tools changelog
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
## 4.13.40 (2024-11-29)
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* Added ability to run auto tests by core variable
|
|
9
|
+
|
|
10
|
+
## 4.13.39 (2024-11-26)
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* Grok publish added ability to link packages
|
|
15
|
+
* Grok test log for multiple workers fix
|
|
16
|
+
|
|
4
17
|
## 4.13.38 (2024-11-15)
|
|
5
18
|
|
|
6
19
|
### Features
|
package/bin/commands/help.js
CHANGED
|
@@ -10,9 +10,9 @@ var HELP_INIT = "\nUsage: grok init\n\nModify a package template by adding confi
|
|
|
10
10
|
var HELP_API = "\nUsage: grok api\n\nCreate wrapper functions for package scripts and queries\n";
|
|
11
11
|
var HELP_CONFIG = "\nUsage: grok config\n\nCreate or update a configuration file\n\nOptions:\n[--reset] [--server] [--alias] [-k | --key]\n\n--reset Restore the default config file template\n--server Use to add a server to the config (`grok config add --alias alias --server url --key key`)\n--alias Use in conjunction with the `server` option to set the server name\n--key Use in conjunction with the `server` option to set the developer key\n--default Use in conjunction with the `server` option to set the added server as default\n";
|
|
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
|
-
var HELP_PUBLISH = "\nUsage: grok publish [host]\n\nUpload a package\n\nOptions:\n[--build|--rebuild] [--debug|--release] [-k | --key] [--suffix] [--all] [--refresh]\n\n--all Publish all available packages \n--refresh Publish all available already loaded packages \n\nRunning `grok publish` is the same as running `grok publish defaultHost --build --debug`\n";
|
|
13
|
+
var HELP_PUBLISH = "\nUsage: grok publish [host]\n\nUpload a package\n\nOptions:\n[--build|--rebuild] [--debug|--release] [-k | --key] [--suffix] [--all] [--refresh] [--link]\n\n--all Publish all available packages \n--refresh Publish all available already loaded packages \n--link \t Link the package to local utils\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[--package] [--category] [--test] [--host] [--csv] [--gui] [--skip-build] [--skip-publish] [--link] [--catchUnhandled] [--report] [--record] [--verbose] [--platform] [--benchmark] [--stress-test]\n\n--package Specify a package name to run tests for\n--category Specify a category name to run tests for\n--test Specify a test name to run \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--link \t Link the package to local utils\n--record Records the test execution process in mp4 format\n--verbose Prints detailed information about passed and skipped tests in the console\n--platform Runs only platform tests (applicable for ApiTests package only)\n--core Runs package & core tests (
|
|
15
|
+
var HELP_TEST = "\nUsage: grok test\n\nOptions:\n[--package] [--category] [--test] [--host] [--csv] [--gui] [--skip-build] [--skip-publish] [--link] [--catchUnhandled] [--report] [--record] [--verbose] [--platform] [--benchmark] [--stress-test]\n\n--package Specify a package name to run tests for\n--category Specify a category name to run tests for\n--test Specify a test name to run \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--link \t Link the package to local utils\n--record Records the test execution process in mp4 format\n--verbose Prints detailed information about passed and skipped tests in the console\n--platform Runs only platform tests (applicable for ApiTests package only)\n--core Runs package & auto tests & core tests (core tests run only from DevTools package)\n--benchmark \t Runs tests in benchmark mode\n--stress-test Runs shuffled stress-test only\n \nRun package tests\n\nSee instructions:\nhttps://datagrok.ai/help/develop/how-to/test-packages#local-testing\n";
|
|
16
16
|
var HELP_TESTALL = "\nUsage: grok testall\n\nOptions:\n[--packages] [--host] [--csv] [--gui] [--skip-build] [--skip-publish] [--link-package] [--catchUnhandled] [--report] [--record] [--verbose] [--benchmark] [--stress-test] [--order] [--tags] [--testRepeat] [--workersCount]\n\n--packages Specify a packages names 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 packages author (default=false)\n--skip-build Skip the packages build step\n--skip-publish Skip the packages publication step\n--link-package \t Link the packages to local utils\n--record Records the test execution process in mp4 format\n--verbose Prints detailed information about passed and skipped tests in the console\n--core Runs packages & core tests (applicable for DevTools packages only)\n--benchmark \t Runs tests in benchmark mode\n--stress-test Runs shuffled stress-test only\n--order Specify order for tests invocation\n--tags Filter tests by tag name for run\n--testRepeat Set amount of tests repeats\n--workersCount Set amount of workers for tests run\n\nRun tests of all or specified packages \n\nSee instructions:\nhttps://datagrok.ai/help/develop/how-to/test-packages#local-testing\n";
|
|
17
17
|
var HELP_LINK = "\nUsage: grok link\n\nLink `datagrok-api` and libraries for local development\n";
|
|
18
18
|
|
package/bin/commands/publish.js
CHANGED
|
@@ -52,73 +52,72 @@ function _processPackage() {
|
|
|
52
52
|
timestamps = {};
|
|
53
53
|
url = "".concat(host, "/packages/dev/").concat(devKey, "/").concat(packageName);
|
|
54
54
|
if (!debug) {
|
|
55
|
-
_context2.next =
|
|
55
|
+
_context2.next = 18;
|
|
56
56
|
break;
|
|
57
57
|
}
|
|
58
58
|
_context2.prev = 3;
|
|
59
|
-
|
|
60
|
-
_context2.next = 7;
|
|
59
|
+
_context2.next = 6;
|
|
61
60
|
return (0, _nodeFetch["default"])(url + '/timestamps');
|
|
62
|
-
case
|
|
63
|
-
_context2.next =
|
|
61
|
+
case 6:
|
|
62
|
+
_context2.next = 8;
|
|
64
63
|
return _context2.sent.json();
|
|
65
|
-
case
|
|
64
|
+
case 8:
|
|
66
65
|
timestamps = _context2.sent;
|
|
67
66
|
if (!(timestamps['#type'] === 'ApiError')) {
|
|
68
|
-
_context2.next =
|
|
67
|
+
_context2.next = 12;
|
|
69
68
|
break;
|
|
70
69
|
}
|
|
71
70
|
color.error(timestamps.message);
|
|
72
71
|
return _context2.abrupt("return", 1);
|
|
73
|
-
case
|
|
74
|
-
_context2.next =
|
|
72
|
+
case 12:
|
|
73
|
+
_context2.next = 18;
|
|
75
74
|
break;
|
|
76
|
-
case
|
|
77
|
-
_context2.prev =
|
|
75
|
+
case 14:
|
|
76
|
+
_context2.prev = 14;
|
|
78
77
|
_context2.t0 = _context2["catch"](3);
|
|
79
78
|
console.error(_context2.t0);
|
|
80
79
|
return _context2.abrupt("return", 1);
|
|
81
|
-
case
|
|
80
|
+
case 18:
|
|
82
81
|
zip = (0, _archiverPromise["default"])('zip', {
|
|
83
82
|
store: false
|
|
84
83
|
}); // Gather the files
|
|
85
84
|
localTimestamps = {};
|
|
86
|
-
_context2.next =
|
|
85
|
+
_context2.next = 22;
|
|
87
86
|
return (0, _ignoreWalk["default"])({
|
|
88
87
|
path: '.',
|
|
89
88
|
ignoreFiles: ['.npmignore', '.gitignore', '.grokignore'],
|
|
90
89
|
includeEmpty: false,
|
|
91
90
|
follow: true
|
|
92
91
|
});
|
|
93
|
-
case
|
|
92
|
+
case 22:
|
|
94
93
|
files = _context2.sent;
|
|
95
94
|
isWebpack = _fs["default"].existsSync('webpack.config.js');
|
|
96
95
|
if (!(!rebuild && isWebpack)) {
|
|
97
|
-
_context2.next =
|
|
96
|
+
_context2.next = 34;
|
|
98
97
|
break;
|
|
99
98
|
}
|
|
100
99
|
if (!_fs["default"].existsSync('dist/package.js')) {
|
|
101
|
-
_context2.next =
|
|
100
|
+
_context2.next = 32;
|
|
102
101
|
break;
|
|
103
102
|
}
|
|
104
|
-
_context2.next =
|
|
103
|
+
_context2.next = 28;
|
|
105
104
|
return (0, _ignoreWalk["default"])({
|
|
106
105
|
path: './dist',
|
|
107
106
|
ignoreFiles: [],
|
|
108
107
|
includeEmpty: false,
|
|
109
108
|
follow: true
|
|
110
109
|
});
|
|
111
|
-
case
|
|
110
|
+
case 28:
|
|
112
111
|
distFiles = _context2.sent;
|
|
113
112
|
distFiles.forEach(function (df) {
|
|
114
113
|
files.push("dist/".concat(df));
|
|
115
114
|
});
|
|
116
|
-
_context2.next =
|
|
115
|
+
_context2.next = 34;
|
|
117
116
|
break;
|
|
118
|
-
case
|
|
117
|
+
case 32:
|
|
119
118
|
color.warn('File `dist/package.js` not found. Building the package on the server side...\n' + 'Next time, please build your package locally with Webpack beforehand\n' + 'or run `grok publish` with the `--rebuild` option');
|
|
120
119
|
rebuild = true;
|
|
121
|
-
case
|
|
120
|
+
case 34:
|
|
122
121
|
contentValidationLog = '';
|
|
123
122
|
console.log('Starting package checks...');
|
|
124
123
|
checkStart = Date.now();
|
|
@@ -208,14 +207,14 @@ function _processPackage() {
|
|
|
208
207
|
console.log("Adding ".concat(canonicalRelativePath, "..."));
|
|
209
208
|
});
|
|
210
209
|
if (!errs.length) {
|
|
211
|
-
_context2.next =
|
|
210
|
+
_context2.next = 55;
|
|
212
211
|
break;
|
|
213
212
|
}
|
|
214
213
|
errs.forEach(function (e) {
|
|
215
214
|
return color.error(e);
|
|
216
215
|
});
|
|
217
216
|
return _context2.abrupt("return", 1);
|
|
218
|
-
case
|
|
217
|
+
case 55:
|
|
219
218
|
zip.append(JSON.stringify(localTimestamps), {
|
|
220
219
|
name: 'timestamps.json'
|
|
221
220
|
});
|
|
@@ -260,41 +259,41 @@ function _processPackage() {
|
|
|
260
259
|
})["catch"](function (error) {
|
|
261
260
|
console.error(error);
|
|
262
261
|
});
|
|
263
|
-
_context2.next =
|
|
262
|
+
_context2.next = 61;
|
|
264
263
|
return zip.finalize();
|
|
265
|
-
case
|
|
266
|
-
_context2.prev =
|
|
267
|
-
_context2.next =
|
|
264
|
+
case 61:
|
|
265
|
+
_context2.prev = 61;
|
|
266
|
+
_context2.next = 64;
|
|
268
267
|
return uploadPromise;
|
|
269
|
-
case
|
|
268
|
+
case 64:
|
|
270
269
|
log = _context2.sent;
|
|
271
270
|
_fs["default"].unlinkSync('zip');
|
|
272
271
|
if (!(log['#type'] === 'ApiError')) {
|
|
273
|
-
_context2.next =
|
|
272
|
+
_context2.next = 73;
|
|
274
273
|
break;
|
|
275
274
|
}
|
|
276
275
|
color.error(log['message']);
|
|
277
276
|
console.error(log['innerMessage']);
|
|
278
277
|
console.log(log);
|
|
279
278
|
return _context2.abrupt("return", 1);
|
|
280
|
-
case
|
|
279
|
+
case 73:
|
|
281
280
|
console.log(log);
|
|
282
281
|
color.warn(contentValidationLog);
|
|
283
|
-
case
|
|
284
|
-
_context2.next =
|
|
282
|
+
case 75:
|
|
283
|
+
_context2.next = 81;
|
|
285
284
|
break;
|
|
286
|
-
case
|
|
287
|
-
_context2.prev =
|
|
288
|
-
_context2.t1 = _context2["catch"](
|
|
285
|
+
case 77:
|
|
286
|
+
_context2.prev = 77;
|
|
287
|
+
_context2.t1 = _context2["catch"](61);
|
|
289
288
|
console.error(_context2.t1);
|
|
290
289
|
return _context2.abrupt("return", 1);
|
|
291
|
-
case
|
|
290
|
+
case 81:
|
|
292
291
|
return _context2.abrupt("return", 0);
|
|
293
|
-
case
|
|
292
|
+
case 82:
|
|
294
293
|
case "end":
|
|
295
294
|
return _context2.stop();
|
|
296
295
|
}
|
|
297
|
-
}, _callee2, null, [[3,
|
|
296
|
+
}, _callee2, null, [[3, 14], [61, 77]]);
|
|
298
297
|
}));
|
|
299
298
|
return _processPackage.apply(this, arguments);
|
|
300
299
|
}
|
|
@@ -338,14 +337,27 @@ function _publish() {
|
|
|
338
337
|
case 18:
|
|
339
338
|
console.log('Loading packages:');
|
|
340
339
|
_context3.next = 21;
|
|
341
|
-
return (0, _testUtils.loadPackages)(curDir, packagesToLoad.join(' '), host, false, false,
|
|
340
|
+
return (0, _testUtils.loadPackages)(curDir, packagesToLoad.join(' '), host, false, false, args.link, args.release);
|
|
342
341
|
case 21:
|
|
343
|
-
_context3.next =
|
|
342
|
+
_context3.next = 32;
|
|
344
343
|
break;
|
|
345
344
|
case 23:
|
|
346
|
-
|
|
345
|
+
if (!args.link) {
|
|
346
|
+
_context3.next = 30;
|
|
347
|
+
break;
|
|
348
|
+
}
|
|
349
|
+
_context3.next = 26;
|
|
350
|
+
return utils.runScript("npm install", curDir);
|
|
351
|
+
case 26:
|
|
352
|
+
_context3.next = 28;
|
|
353
|
+
return utils.runScript("grok link", curDir);
|
|
354
|
+
case 28:
|
|
355
|
+
_context3.next = 30;
|
|
356
|
+
return utils.runScript("npm run build", curDir);
|
|
357
|
+
case 30:
|
|
358
|
+
_context3.next = 32;
|
|
347
359
|
return publishPackage(args);
|
|
348
|
-
case
|
|
360
|
+
case 32:
|
|
349
361
|
case "end":
|
|
350
362
|
return _context3.stop();
|
|
351
363
|
}
|
package/bin/commands/test.js
CHANGED
|
@@ -52,24 +52,25 @@ function _test() {
|
|
|
52
52
|
packagesDir = _path["default"].basename(curDir) === "packages" ? curDir : _path["default"].dirname(curDir);
|
|
53
53
|
console.log('Environment variable `TARGET_PACKAGE` is set to', packageName);
|
|
54
54
|
if (args.platform && packageName !== 'ApiTests') color.warn('--platform flag can only be used in the ApiTests package');
|
|
55
|
-
if (args.core && packageName !== 'DevTools')
|
|
55
|
+
// if (args.core && packageName !== 'DevTools')
|
|
56
|
+
// color.warn('--core flag can only be used in the DevTools package');
|
|
56
57
|
if (args["package"]) {
|
|
57
|
-
_context.next =
|
|
58
|
+
_context.next = 12;
|
|
58
59
|
break;
|
|
59
60
|
}
|
|
60
|
-
_context.next =
|
|
61
|
+
_context.next = 12;
|
|
61
62
|
return testUtils.loadPackages(packagesDir, packageName, args.host, args['skip-publish'], args['skip-build'], args.link);
|
|
62
|
-
case
|
|
63
|
+
case 12:
|
|
63
64
|
process.env.TARGET_PACKAGE = packageName;
|
|
64
|
-
_context.next =
|
|
65
|
+
_context.next = 15;
|
|
65
66
|
return runTesting(args);
|
|
66
|
-
case
|
|
67
|
+
case 15:
|
|
67
68
|
res = _context.sent;
|
|
68
69
|
if (args.csv) (0, _testUtils.saveCsvResults)([res.csv], csvReportDir);
|
|
69
70
|
(0, _testUtils.printWorkersResult)(res, args.verbose);
|
|
70
71
|
if (!res) testUtils.exitWithCode(1);else testUtils.exitWithCode(0);
|
|
71
72
|
return _context.abrupt("return", true);
|
|
72
|
-
case
|
|
73
|
+
case 20:
|
|
73
74
|
case "end":
|
|
74
75
|
return _context.stop();
|
|
75
76
|
}
|
|
@@ -88,17 +89,18 @@ function runTesting(_x2) {
|
|
|
88
89
|
return _runTesting.apply(this, arguments);
|
|
89
90
|
}
|
|
90
91
|
function _runTesting() {
|
|
91
|
-
_runTesting = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
92
|
+
_runTesting = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(args) {
|
|
92
93
|
var _process$env$TARGET_P;
|
|
93
|
-
var testsObj, parsed, organized, filtered, _iterator, _step, element, testsResults, r,
|
|
94
|
-
return _regenerator["default"].wrap(function
|
|
95
|
-
while (1) switch (
|
|
94
|
+
var testsObj, parsed, organized, filtered, _iterator, _step, element, testsResults, r, workerId;
|
|
95
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
96
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
96
97
|
case 0:
|
|
97
98
|
color.info('Loading tests...');
|
|
98
|
-
|
|
99
|
+
_context3.next = 3;
|
|
99
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);
|
|
100
101
|
case 3:
|
|
101
|
-
testsObj =
|
|
102
|
+
testsObj = _context3.sent;
|
|
103
|
+
console.log(testsObj);
|
|
102
104
|
parsed = (0, _orderFunctions.setAlphabeticalOrder)(testsObj, 1, 1);
|
|
103
105
|
organized = parsed[0].map(function (testObj) {
|
|
104
106
|
return {
|
|
@@ -132,93 +134,106 @@ function _runTesting() {
|
|
|
132
134
|
}
|
|
133
135
|
color.info('Starting tests...');
|
|
134
136
|
testsResults = [];
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return (0, _testUtils.
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
137
|
+
workerId = 1;
|
|
138
|
+
_context3.next = 14;
|
|
139
|
+
return (0, _testUtils.timeout)( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
140
|
+
var _args$benchmark, _args$catchUnhandled, _args$gui, _args$record, _args$report, _args$verbose, testsLeft, testsToReproduce, _iterator2, _step2, testData, reproduced, _iterator3, _step3, _test2, _reproducedTest2;
|
|
141
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
142
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
143
|
+
case 0:
|
|
144
|
+
_context2.next = 2;
|
|
145
|
+
return (0, _testUtils.runWorker)(organized, {
|
|
146
|
+
benchmark: (_args$benchmark = args.benchmark) !== null && _args$benchmark !== void 0 ? _args$benchmark : false,
|
|
147
|
+
catchUnhandled: (_args$catchUnhandled = args.catchUnhandled) !== null && _args$catchUnhandled !== void 0 ? _args$catchUnhandled : false,
|
|
148
|
+
gui: (_args$gui = args.gui) !== null && _args$gui !== void 0 ? _args$gui : false,
|
|
149
|
+
record: (_args$record = args.record) !== null && _args$record !== void 0 ? _args$record : false,
|
|
150
|
+
report: (_args$report = args.report) !== null && _args$report !== void 0 ? _args$report : false,
|
|
151
|
+
verbose: (_args$verbose = args.verbose) !== null && _args$verbose !== void 0 ? _args$verbose : false,
|
|
152
|
+
stopOnTimeout: true
|
|
153
|
+
}, workerId, testInvocationTimeout);
|
|
154
|
+
case 2:
|
|
155
|
+
r = _context2.sent;
|
|
156
|
+
testsLeft = [];
|
|
157
|
+
testsToReproduce = [];
|
|
158
|
+
_iterator2 = _createForOfIteratorHelper(organized);
|
|
159
|
+
try {
|
|
160
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
161
|
+
testData = _step2.value;
|
|
162
|
+
if (!r.csv.includes("".concat(testData.params.category, ",").concat(testData.params.test))) testsLeft.push(testData);
|
|
163
|
+
if (r.verboseFailed.includes("".concat(testData.params.category, ": ").concat(testData.params.test, " : Error:"))) {
|
|
164
|
+
testsToReproduce.push(testData);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
} catch (err) {
|
|
168
|
+
_iterator2.e(err);
|
|
169
|
+
} finally {
|
|
170
|
+
_iterator2.f();
|
|
171
|
+
}
|
|
172
|
+
if (!(testsToReproduce.length > 0)) {
|
|
173
|
+
_context2.next = 31;
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
_context2.next = 10;
|
|
177
|
+
return reproducedTest(args, testsToReproduce);
|
|
178
|
+
case 10:
|
|
179
|
+
reproduced = _context2.sent;
|
|
180
|
+
_iterator3 = _createForOfIteratorHelper(testsToReproduce);
|
|
181
|
+
_context2.prev = 12;
|
|
182
|
+
_iterator3.s();
|
|
183
|
+
case 14:
|
|
184
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
185
|
+
_context2.next = 23;
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
_test2 = _step3.value;
|
|
189
|
+
_reproducedTest2 = reproduced.get(_test2);
|
|
190
|
+
if (!(_reproducedTest2 && !_reproducedTest2.failed)) {
|
|
191
|
+
_context2.next = 21;
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
_context2.next = 20;
|
|
195
|
+
return updateResultsByReproduced(r, _reproducedTest2, _test2);
|
|
196
|
+
case 20:
|
|
197
|
+
r = _context2.sent;
|
|
198
|
+
case 21:
|
|
199
|
+
_context2.next = 14;
|
|
200
|
+
break;
|
|
201
|
+
case 23:
|
|
202
|
+
_context2.next = 28;
|
|
203
|
+
break;
|
|
204
|
+
case 25:
|
|
205
|
+
_context2.prev = 25;
|
|
206
|
+
_context2.t0 = _context2["catch"](12);
|
|
207
|
+
_iterator3.e(_context2.t0);
|
|
208
|
+
case 28:
|
|
209
|
+
_context2.prev = 28;
|
|
210
|
+
_iterator3.f();
|
|
211
|
+
return _context2.finish(28);
|
|
212
|
+
case 31:
|
|
213
|
+
testsResults.push(r);
|
|
214
|
+
organized = testsLeft;
|
|
215
|
+
workerId++;
|
|
216
|
+
case 34:
|
|
217
|
+
if (r.failed) {
|
|
218
|
+
_context2.next = 0;
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
case 35:
|
|
222
|
+
case "end":
|
|
223
|
+
return _context2.stop();
|
|
157
224
|
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
_iterator2.f();
|
|
163
|
-
}
|
|
164
|
-
if (!(testsToReproduce.length > 0)) {
|
|
165
|
-
_context2.next = 41;
|
|
166
|
-
break;
|
|
167
|
-
}
|
|
168
|
-
_context2.next = 20;
|
|
169
|
-
return reproducedTest(args, testsToReproduce);
|
|
170
|
-
case 20:
|
|
171
|
-
reproduced = _context2.sent;
|
|
172
|
-
_iterator3 = _createForOfIteratorHelper(testsToReproduce);
|
|
173
|
-
_context2.prev = 22;
|
|
174
|
-
_iterator3.s();
|
|
175
|
-
case 24:
|
|
176
|
-
if ((_step3 = _iterator3.n()).done) {
|
|
177
|
-
_context2.next = 33;
|
|
178
|
-
break;
|
|
179
|
-
}
|
|
180
|
-
_test2 = _step3.value;
|
|
181
|
-
_reproducedTest2 = reproduced.get(_test2);
|
|
182
|
-
if (!(_reproducedTest2 && !_reproducedTest2.failed)) {
|
|
183
|
-
_context2.next = 31;
|
|
184
|
-
break;
|
|
185
|
-
}
|
|
186
|
-
_context2.next = 30;
|
|
187
|
-
return updateResultsByReproduced(r, _reproducedTest2, _test2);
|
|
188
|
-
case 30:
|
|
189
|
-
r = _context2.sent;
|
|
190
|
-
case 31:
|
|
191
|
-
_context2.next = 24;
|
|
192
|
-
break;
|
|
193
|
-
case 33:
|
|
194
|
-
_context2.next = 38;
|
|
195
|
-
break;
|
|
196
|
-
case 35:
|
|
197
|
-
_context2.prev = 35;
|
|
198
|
-
_context2.t0 = _context2["catch"](22);
|
|
199
|
-
_iterator3.e(_context2.t0);
|
|
200
|
-
case 38:
|
|
201
|
-
_context2.prev = 38;
|
|
202
|
-
_iterator3.f();
|
|
203
|
-
return _context2.finish(38);
|
|
204
|
-
case 41:
|
|
205
|
-
testsResults.push(r);
|
|
206
|
-
organized = testsLeft;
|
|
207
|
-
case 43:
|
|
208
|
-
if (r.failed) {
|
|
209
|
-
_context2.next = 10;
|
|
210
|
-
break;
|
|
211
|
-
}
|
|
212
|
-
case 44:
|
|
213
|
-
_context2.next = 46;
|
|
225
|
+
}, _callee2, null, [[12, 25, 28, 31]]);
|
|
226
|
+
})), testInvocationTimeout);
|
|
227
|
+
case 14:
|
|
228
|
+
_context3.next = 16;
|
|
214
229
|
return (0, _testUtils.mergeWorkersResults)(testsResults);
|
|
215
|
-
case
|
|
216
|
-
return
|
|
217
|
-
case
|
|
230
|
+
case 16:
|
|
231
|
+
return _context3.abrupt("return", _context3.sent);
|
|
232
|
+
case 17:
|
|
218
233
|
case "end":
|
|
219
|
-
return
|
|
234
|
+
return _context3.stop();
|
|
220
235
|
}
|
|
221
|
-
},
|
|
236
|
+
}, _callee3);
|
|
222
237
|
}));
|
|
223
238
|
return _runTesting.apply(this, arguments);
|
|
224
239
|
}
|
|
@@ -226,22 +241,22 @@ function reproducedTest(_x3, _x4) {
|
|
|
226
241
|
return _reproducedTest.apply(this, arguments);
|
|
227
242
|
}
|
|
228
243
|
function _reproducedTest() {
|
|
229
|
-
_reproducedTest = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
244
|
+
_reproducedTest = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(args, testsToReproduce) {
|
|
230
245
|
var res, _iterator4, _step4, _args$benchmark2, _test3, r;
|
|
231
|
-
return _regenerator["default"].wrap(function
|
|
232
|
-
while (1) switch (
|
|
246
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
247
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
233
248
|
case 0:
|
|
234
249
|
res = new Map();
|
|
235
250
|
_iterator4 = _createForOfIteratorHelper(testsToReproduce);
|
|
236
|
-
|
|
251
|
+
_context4.prev = 2;
|
|
237
252
|
_iterator4.s();
|
|
238
253
|
case 4:
|
|
239
254
|
if ((_step4 = _iterator4.n()).done) {
|
|
240
|
-
|
|
255
|
+
_context4.next = 12;
|
|
241
256
|
break;
|
|
242
257
|
}
|
|
243
258
|
_test3 = _step4.value;
|
|
244
|
-
|
|
259
|
+
_context4.next = 8;
|
|
245
260
|
return (0, _testUtils.runWorker)([_test3], {
|
|
246
261
|
benchmark: (_args$benchmark2 = args.benchmark) !== null && _args$benchmark2 !== void 0 ? _args$benchmark2 : false,
|
|
247
262
|
catchUnhandled: false,
|
|
@@ -251,31 +266,31 @@ function _reproducedTest() {
|
|
|
251
266
|
verbose: false,
|
|
252
267
|
stopOnTimeout: true,
|
|
253
268
|
reproduce: true
|
|
254
|
-
},
|
|
269
|
+
}, 0, testInvocationTimeout);
|
|
255
270
|
case 8:
|
|
256
|
-
r =
|
|
271
|
+
r = _context4.sent;
|
|
257
272
|
if (_test3.params.category && _test3.params.test) res.set(_test3, r);
|
|
258
273
|
case 10:
|
|
259
|
-
|
|
274
|
+
_context4.next = 4;
|
|
260
275
|
break;
|
|
261
276
|
case 12:
|
|
262
|
-
|
|
277
|
+
_context4.next = 17;
|
|
263
278
|
break;
|
|
264
279
|
case 14:
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
_iterator4.e(
|
|
280
|
+
_context4.prev = 14;
|
|
281
|
+
_context4.t0 = _context4["catch"](2);
|
|
282
|
+
_iterator4.e(_context4.t0);
|
|
268
283
|
case 17:
|
|
269
|
-
|
|
284
|
+
_context4.prev = 17;
|
|
270
285
|
_iterator4.f();
|
|
271
|
-
return
|
|
286
|
+
return _context4.finish(17);
|
|
272
287
|
case 20:
|
|
273
|
-
return
|
|
288
|
+
return _context4.abrupt("return", res);
|
|
274
289
|
case 21:
|
|
275
290
|
case "end":
|
|
276
|
-
return
|
|
291
|
+
return _context4.stop();
|
|
277
292
|
}
|
|
278
|
-
},
|
|
293
|
+
}, _callee4, null, [[2, 14, 17, 20]]);
|
|
279
294
|
}));
|
|
280
295
|
return _reproducedTest.apply(this, arguments);
|
|
281
296
|
}
|
|
@@ -283,10 +298,10 @@ function updateResultsByReproduced(_x5, _x6, _x7) {
|
|
|
283
298
|
return _updateResultsByReproduced.apply(this, arguments);
|
|
284
299
|
}
|
|
285
300
|
function _updateResultsByReproduced() {
|
|
286
|
-
_updateResultsByReproduced = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
301
|
+
_updateResultsByReproduced = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(curentResult, reproducedResult, testsParams) {
|
|
287
302
|
var table2Dict, table1, table2, flakingMap;
|
|
288
|
-
return _regenerator["default"].wrap(function
|
|
289
|
-
while (1) switch (
|
|
303
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
304
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
290
305
|
case 0:
|
|
291
306
|
table2Dict = {};
|
|
292
307
|
table1 = readCSVResultData(curentResult.csv);
|
|
@@ -307,12 +322,12 @@ function _updateResultsByReproduced() {
|
|
|
307
322
|
});
|
|
308
323
|
;
|
|
309
324
|
curentResult.verboseFailed = curentResult.verboseFailed.replaceAll("".concat(testsParams.params.category, ": ").concat(testsParams.params.test, " : Error:"), "".concat(testsParams.params.category, ": ").concat(testsParams.params.test, " : Flaking Error:"));
|
|
310
|
-
return
|
|
325
|
+
return _context5.abrupt("return", curentResult);
|
|
311
326
|
case 10:
|
|
312
327
|
case "end":
|
|
313
|
-
return
|
|
328
|
+
return _context5.stop();
|
|
314
329
|
}
|
|
315
|
-
},
|
|
330
|
+
}, _callee5);
|
|
316
331
|
}));
|
|
317
332
|
return _updateResultsByReproduced.apply(this, arguments);
|
|
318
333
|
}
|
package/bin/utils/test-utils.js
CHANGED
|
@@ -349,13 +349,13 @@ function _loadPackages() {
|
|
|
349
349
|
_iterator2.s();
|
|
350
350
|
case 6:
|
|
351
351
|
if ((_step2 = _iterator2.n()).done) {
|
|
352
|
-
_context6.next =
|
|
352
|
+
_context6.next = 41;
|
|
353
353
|
break;
|
|
354
354
|
}
|
|
355
355
|
dirName = _step2.value;
|
|
356
356
|
packageDir = _path["default"].join(packagesDir, dirName);
|
|
357
357
|
if (_fs["default"].lstatSync(packageDir).isFile()) {
|
|
358
|
-
_context6.next =
|
|
358
|
+
_context6.next = 39;
|
|
359
359
|
break;
|
|
360
360
|
}
|
|
361
361
|
_context6.prev = 10;
|
|
@@ -364,64 +364,65 @@ function _loadPackages() {
|
|
|
364
364
|
}));
|
|
365
365
|
packageFriendlyName = packagesToRun.get((_spaceToCamelCase$toL = (0, _utils.spaceToCamelCase)((_ref6 = (_ref7 = (_packageJsonData$frie = packageJsonData["friendlyName"]) !== null && _packageJsonData$frie !== void 0 ? _packageJsonData$frie : packageJsonData["name"].split("/")[1]) !== null && _ref7 !== void 0 ? _ref7 : packageJsonData["name"]) !== null && _ref6 !== void 0 ? _ref6 : '').toLocaleLowerCase()) !== null && _spaceToCamelCase$toL !== void 0 ? _spaceToCamelCase$toL : "");
|
|
366
366
|
if (!(utils.isPackageDir(packageDir) && (packageFriendlyName !== undefined || packagesToLoad === "all"))) {
|
|
367
|
-
_context6.next =
|
|
367
|
+
_context6.next = 34;
|
|
368
368
|
break;
|
|
369
369
|
}
|
|
370
370
|
_context6.prev = 14;
|
|
371
|
+
console.log("Loading package ".concat(dirName));
|
|
371
372
|
if (!(skipPublish != true)) {
|
|
372
|
-
_context6.next =
|
|
373
|
+
_context6.next = 27;
|
|
373
374
|
break;
|
|
374
375
|
}
|
|
375
|
-
_context6.next =
|
|
376
|
+
_context6.next = 19;
|
|
376
377
|
return utils.runScript("npm install", packageDir);
|
|
377
|
-
case
|
|
378
|
+
case 19:
|
|
378
379
|
if (!linkPackage) {
|
|
379
|
-
_context6.next =
|
|
380
|
+
_context6.next = 22;
|
|
380
381
|
break;
|
|
381
382
|
}
|
|
382
|
-
_context6.next =
|
|
383
|
+
_context6.next = 22;
|
|
383
384
|
return utils.runScript("grok link", packageDir);
|
|
384
|
-
case
|
|
385
|
+
case 22:
|
|
385
386
|
if (!(skipBuild != true)) {
|
|
386
|
-
_context6.next =
|
|
387
|
+
_context6.next = 25;
|
|
387
388
|
break;
|
|
388
389
|
}
|
|
389
|
-
_context6.next =
|
|
390
|
+
_context6.next = 25;
|
|
390
391
|
return utils.runScript("npm run build", packageDir);
|
|
391
|
-
case
|
|
392
|
-
_context6.next =
|
|
392
|
+
case 25:
|
|
393
|
+
_context6.next = 27;
|
|
393
394
|
return utils.runScript("grok publish ".concat(hostString).concat(release ? ' --release' : ''), packageDir);
|
|
394
|
-
case
|
|
395
|
+
case 27:
|
|
395
396
|
packagesToRun.set(dirName, true);
|
|
396
397
|
console.log("Package published ".concat(dirName));
|
|
397
|
-
_context6.next =
|
|
398
|
+
_context6.next = 34;
|
|
398
399
|
break;
|
|
399
|
-
case
|
|
400
|
-
_context6.prev =
|
|
400
|
+
case 31:
|
|
401
|
+
_context6.prev = 31;
|
|
401
402
|
_context6.t0 = _context6["catch"](14);
|
|
402
403
|
console.log("Package wasn't published ".concat(dirName));
|
|
403
|
-
case
|
|
404
|
-
_context6.next =
|
|
404
|
+
case 34:
|
|
405
|
+
_context6.next = 39;
|
|
405
406
|
break;
|
|
406
|
-
case
|
|
407
|
-
_context6.prev =
|
|
407
|
+
case 36:
|
|
408
|
+
_context6.prev = 36;
|
|
408
409
|
_context6.t1 = _context6["catch"](10);
|
|
409
410
|
if (utils.isPackageDir(packageDir) && (packagesToRun.get((0, _utils.spaceToCamelCase)(dirName).toLocaleLowerCase()) !== undefined || packagesToLoad === "all")) console.log("Couldn't read package.json ".concat(dirName));
|
|
410
|
-
case
|
|
411
|
+
case 39:
|
|
411
412
|
_context6.next = 6;
|
|
412
413
|
break;
|
|
413
|
-
case
|
|
414
|
-
_context6.next =
|
|
414
|
+
case 41:
|
|
415
|
+
_context6.next = 46;
|
|
415
416
|
break;
|
|
416
|
-
case
|
|
417
|
-
_context6.prev =
|
|
417
|
+
case 43:
|
|
418
|
+
_context6.prev = 43;
|
|
418
419
|
_context6.t2 = _context6["catch"](4);
|
|
419
420
|
_iterator2.e(_context6.t2);
|
|
420
|
-
case
|
|
421
|
-
_context6.prev =
|
|
421
|
+
case 46:
|
|
422
|
+
_context6.prev = 46;
|
|
422
423
|
_iterator2.f();
|
|
423
|
-
return _context6.finish(
|
|
424
|
-
case
|
|
424
|
+
return _context6.finish(46);
|
|
425
|
+
case 49:
|
|
425
426
|
console.log();
|
|
426
427
|
return _context6.abrupt("return", Array.from(packagesToRun).filter(function (_ref2) {
|
|
427
428
|
var _ref3 = (0, _slicedToArray2["default"])(_ref2, 2),
|
|
@@ -433,11 +434,11 @@ function _loadPackages() {
|
|
|
433
434
|
key = _ref5[0];
|
|
434
435
|
return key;
|
|
435
436
|
}));
|
|
436
|
-
case
|
|
437
|
+
case 52:
|
|
437
438
|
case "end":
|
|
438
439
|
return _context6.stop();
|
|
439
440
|
}
|
|
440
|
-
}, _callee6, null, [[4,
|
|
441
|
+
}, _callee6, null, [[4, 43, 46, 49], [10, 36], [14, 31]]);
|
|
441
442
|
}));
|
|
442
443
|
return _loadPackages.apply(this, arguments);
|
|
443
444
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { runTests, tests, TestContext , initAutoTests as initTests } from '@datagrok-libraries/utils/src/test';
|
|
2
|
-
import
|
|
2
|
+
import * as DG from 'datagrok-api/dg';
|
|
3
3
|
|
|
4
4
|
export let _package = new DG.Package();
|
|
5
5
|
export { tests };
|
|
@@ -9,7 +9,7 @@ export { tests };
|
|
|
9
9
|
//input: string test {optional: true}
|
|
10
10
|
//input: object testContext {optional: true}
|
|
11
11
|
//output: dataframe result
|
|
12
|
-
export async function test(category: string, test: string, testContext: TestContext): Promise<DataFrame> {
|
|
12
|
+
export async function test(category: string, test: string, testContext: TestContext): Promise<DG.DataFrame> {
|
|
13
13
|
const data = await runTests({ category, test, testContext });
|
|
14
14
|
return DG.DataFrame.fromObjects(data)!;
|
|
15
15
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as grokNamespace from 'datagrok-api/grok';
|
|
2
|
-
import * as uiNamespace from 'datagrok-api/ui';
|
|
3
|
-
import * as DGNamespace from 'datagrok-api/dg';
|
|
4
|
-
import * as rxjsNamespace from 'rxjs';
|
|
5
|
-
import $Namespace from 'cash-dom';
|
|
6
|
-
|
|
7
|
-
declare global {
|
|
8
|
-
const grok: typeof grokNamespace;
|
|
9
|
-
const ui: typeof uiNamespace;
|
|
10
|
-
const DG: typeof DGNamespace;
|
|
11
|
-
const rjxs: typeof rxjsNamespace;
|
|
12
|
-
const $: typeof $Namespace;
|
|
13
|
-
}
|