datagrok-tools 4.13.35 → 4.13.37
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 +11 -0
- package/bin/commands/test.js +172 -25
- package/bin/utils/test-utils.js +1 -0
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
package/bin/commands/test.js
CHANGED
|
@@ -14,6 +14,7 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
14
14
|
var _jsYaml = _interopRequireDefault(require("js-yaml"));
|
|
15
15
|
var utils = _interopRequireWildcard(require("../utils/utils"));
|
|
16
16
|
var color = _interopRequireWildcard(require("../utils/color-utils"));
|
|
17
|
+
var Papa = _interopRequireWildcard(require("papaparse"));
|
|
17
18
|
var _testUtils = _interopRequireWildcard(require("../utils/test-utils"));
|
|
18
19
|
var testUtils = _testUtils;
|
|
19
20
|
var _orderFunctions = require("../utils/order-functions");
|
|
@@ -34,7 +35,7 @@ function test(_x) {
|
|
|
34
35
|
}
|
|
35
36
|
function _test() {
|
|
36
37
|
_test = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(args) {
|
|
37
|
-
var config, packageJsonData, packageName, packagesDir,
|
|
38
|
+
var config, packageJsonData, packageName, packagesDir, res;
|
|
38
39
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
39
40
|
while (1) switch (_context.prev = _context.next) {
|
|
40
41
|
case 0:
|
|
@@ -49,32 +50,26 @@ function _test() {
|
|
|
49
50
|
}));
|
|
50
51
|
packageName = args["package"] ? utils.kebabToCamelCase(args["package"]) : utils.kebabToCamelCase(utils.removeScope(packageJsonData.name));
|
|
51
52
|
packagesDir = _path["default"].basename(curDir) === "packages" ? curDir : _path["default"].dirname(curDir);
|
|
52
|
-
categoryToCheck = undefined;
|
|
53
|
-
testToCheck = undefined;
|
|
54
|
-
if (args.category) {
|
|
55
|
-
categoryToCheck = args.category.toString();
|
|
56
|
-
if (args.test) testToCheck = args.test.toString();
|
|
57
|
-
}
|
|
58
53
|
console.log('Environment variable `TARGET_PACKAGE` is set to', packageName);
|
|
59
54
|
if (args.platform && packageName !== 'ApiTests') color.warn('--platform flag can only be used in the ApiTests package');
|
|
60
55
|
if (args.core && packageName !== 'DevTools') color.warn('--core flag can only be used in the DevTools package');
|
|
61
56
|
if (args["package"]) {
|
|
62
|
-
_context.next =
|
|
57
|
+
_context.next = 13;
|
|
63
58
|
break;
|
|
64
59
|
}
|
|
65
|
-
_context.next =
|
|
60
|
+
_context.next = 13;
|
|
66
61
|
return testUtils.loadPackages(packagesDir, packageName, args.host, args['skip-publish'], args['skip-build'], args.link);
|
|
67
|
-
case
|
|
62
|
+
case 13:
|
|
68
63
|
process.env.TARGET_PACKAGE = packageName;
|
|
69
|
-
_context.next =
|
|
70
|
-
return runTesting(args
|
|
71
|
-
case
|
|
64
|
+
_context.next = 16;
|
|
65
|
+
return runTesting(args);
|
|
66
|
+
case 16:
|
|
72
67
|
res = _context.sent;
|
|
73
68
|
if (args.csv) (0, _testUtils.saveCsvResults)([res.csv], csvReportDir);
|
|
74
69
|
(0, _testUtils.printWorkersResult)(res, args.verbose);
|
|
75
70
|
if (!res) testUtils.exitWithCode(1);else testUtils.exitWithCode(0);
|
|
76
71
|
return _context.abrupt("return", true);
|
|
77
|
-
case
|
|
72
|
+
case 21:
|
|
78
73
|
case "end":
|
|
79
74
|
return _context.stop();
|
|
80
75
|
}
|
|
@@ -89,13 +84,13 @@ function isArgsValid(args) {
|
|
|
89
84
|
})) return false;
|
|
90
85
|
return true;
|
|
91
86
|
}
|
|
92
|
-
function runTesting(_x2
|
|
87
|
+
function runTesting(_x2) {
|
|
93
88
|
return _runTesting.apply(this, arguments);
|
|
94
89
|
}
|
|
95
90
|
function _runTesting() {
|
|
96
|
-
_runTesting = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(args
|
|
91
|
+
_runTesting = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(args) {
|
|
97
92
|
var _process$env$TARGET_P;
|
|
98
|
-
var testsObj, parsed, organized, filtered, _iterator, _step, element, testsResults, r, _args$benchmark, _args$catchUnhandled, _args$gui, _args$record, _args$report, _args$verbose, testsLeft, _iterator2, _step2, testData;
|
|
93
|
+
var testsObj, parsed, organized, filtered, _iterator, _step, element, testsResults, r, _args$benchmark, _args$catchUnhandled, _args$gui, _args$record, _args$report, _args$verbose, testsLeft, testsToReproduce, _iterator2, _step2, testData, reproduced, _iterator3, _step3, _test2, _reproducedTest2;
|
|
99
94
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
100
95
|
while (1) switch (_context2.prev = _context2.next) {
|
|
101
96
|
case 0:
|
|
@@ -150,35 +145,187 @@ function _runTesting() {
|
|
|
150
145
|
}, 1, testInvocationTimeout);
|
|
151
146
|
case 12:
|
|
152
147
|
r = _context2.sent;
|
|
153
|
-
testsResults.push(r);
|
|
154
148
|
testsLeft = [];
|
|
149
|
+
testsToReproduce = [];
|
|
155
150
|
_iterator2 = _createForOfIteratorHelper(organized);
|
|
156
151
|
try {
|
|
157
152
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
158
153
|
testData = _step2.value;
|
|
159
154
|
if (!r.csv.includes("".concat(testData.params.category, ",").concat(testData.params.test))) testsLeft.push(testData);
|
|
155
|
+
if (r.verboseFailed.includes("".concat(testData.params.category, ": ").concat(testData.params.test, " : Error:"))) {
|
|
156
|
+
testsToReproduce.push(testData);
|
|
157
|
+
}
|
|
160
158
|
}
|
|
161
159
|
} catch (err) {
|
|
162
160
|
_iterator2.e(err);
|
|
163
161
|
} finally {
|
|
164
162
|
_iterator2.f();
|
|
165
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);
|
|
166
206
|
organized = testsLeft;
|
|
167
|
-
case
|
|
168
|
-
if (r.verboseFailed.includes('
|
|
207
|
+
case 43:
|
|
208
|
+
if (r.verboseFailed.includes('Error')) {
|
|
169
209
|
_context2.next = 10;
|
|
170
210
|
break;
|
|
171
211
|
}
|
|
172
|
-
case
|
|
173
|
-
_context2.next =
|
|
212
|
+
case 44:
|
|
213
|
+
_context2.next = 46;
|
|
174
214
|
return (0, _testUtils.mergeWorkersResults)(testsResults);
|
|
175
|
-
case
|
|
215
|
+
case 46:
|
|
176
216
|
return _context2.abrupt("return", _context2.sent);
|
|
177
|
-
case
|
|
217
|
+
case 47:
|
|
178
218
|
case "end":
|
|
179
219
|
return _context2.stop();
|
|
180
220
|
}
|
|
181
|
-
}, _callee2);
|
|
221
|
+
}, _callee2, null, [[22, 35, 38, 41]]);
|
|
182
222
|
}));
|
|
183
223
|
return _runTesting.apply(this, arguments);
|
|
224
|
+
}
|
|
225
|
+
function reproducedTest(_x3, _x4) {
|
|
226
|
+
return _reproducedTest.apply(this, arguments);
|
|
227
|
+
}
|
|
228
|
+
function _reproducedTest() {
|
|
229
|
+
_reproducedTest = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(args, testsToReproduce) {
|
|
230
|
+
var res, _iterator4, _step4, _args$benchmark2, _test3, r;
|
|
231
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
232
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
233
|
+
case 0:
|
|
234
|
+
res = new Map();
|
|
235
|
+
_iterator4 = _createForOfIteratorHelper(testsToReproduce);
|
|
236
|
+
_context3.prev = 2;
|
|
237
|
+
_iterator4.s();
|
|
238
|
+
case 4:
|
|
239
|
+
if ((_step4 = _iterator4.n()).done) {
|
|
240
|
+
_context3.next = 12;
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
_test3 = _step4.value;
|
|
244
|
+
_context3.next = 8;
|
|
245
|
+
return (0, _testUtils.runWorker)([_test3], {
|
|
246
|
+
benchmark: (_args$benchmark2 = args.benchmark) !== null && _args$benchmark2 !== void 0 ? _args$benchmark2 : false,
|
|
247
|
+
catchUnhandled: false,
|
|
248
|
+
gui: false,
|
|
249
|
+
record: false,
|
|
250
|
+
report: false,
|
|
251
|
+
verbose: false,
|
|
252
|
+
stopOnTimeout: true,
|
|
253
|
+
reproduce: true
|
|
254
|
+
}, 1, testInvocationTimeout);
|
|
255
|
+
case 8:
|
|
256
|
+
r = _context3.sent;
|
|
257
|
+
if (_test3.params.category && _test3.params.test) res.set(_test3, r);
|
|
258
|
+
case 10:
|
|
259
|
+
_context3.next = 4;
|
|
260
|
+
break;
|
|
261
|
+
case 12:
|
|
262
|
+
_context3.next = 17;
|
|
263
|
+
break;
|
|
264
|
+
case 14:
|
|
265
|
+
_context3.prev = 14;
|
|
266
|
+
_context3.t0 = _context3["catch"](2);
|
|
267
|
+
_iterator4.e(_context3.t0);
|
|
268
|
+
case 17:
|
|
269
|
+
_context3.prev = 17;
|
|
270
|
+
_iterator4.f();
|
|
271
|
+
return _context3.finish(17);
|
|
272
|
+
case 20:
|
|
273
|
+
return _context3.abrupt("return", res);
|
|
274
|
+
case 21:
|
|
275
|
+
case "end":
|
|
276
|
+
return _context3.stop();
|
|
277
|
+
}
|
|
278
|
+
}, _callee3, null, [[2, 14, 17, 20]]);
|
|
279
|
+
}));
|
|
280
|
+
return _reproducedTest.apply(this, arguments);
|
|
281
|
+
}
|
|
282
|
+
function updateResultsByReproduced(_x5, _x6, _x7) {
|
|
283
|
+
return _updateResultsByReproduced.apply(this, arguments);
|
|
284
|
+
}
|
|
285
|
+
function _updateResultsByReproduced() {
|
|
286
|
+
_updateResultsByReproduced = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(curentResult, reproducedResult, testsParams) {
|
|
287
|
+
var table2Dict, table1, table2, flakingMap;
|
|
288
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
289
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
290
|
+
case 0:
|
|
291
|
+
table2Dict = {};
|
|
292
|
+
table1 = readCSVResultData(curentResult.csv);
|
|
293
|
+
table2 = readCSVResultData(reproducedResult.csv);
|
|
294
|
+
flakingMap = {};
|
|
295
|
+
table2.rows.forEach(function (row) {
|
|
296
|
+
var key = "".concat(row['category'], ",").concat(row['name']);
|
|
297
|
+
flakingMap[key] = row['flaking'];
|
|
298
|
+
});
|
|
299
|
+
table1.rows.forEach(function (row) {
|
|
300
|
+
var key = "".concat(row['category'], ",").concat(row['name']);
|
|
301
|
+
if (key in flakingMap) {
|
|
302
|
+
row['flaking'] = flakingMap[key];
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
curentResult.csv = Papa.unparse(table1.rows, {
|
|
306
|
+
columns: table1.headers
|
|
307
|
+
});
|
|
308
|
+
;
|
|
309
|
+
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 _context4.abrupt("return", curentResult);
|
|
311
|
+
case 10:
|
|
312
|
+
case "end":
|
|
313
|
+
return _context4.stop();
|
|
314
|
+
}
|
|
315
|
+
}, _callee4);
|
|
316
|
+
}));
|
|
317
|
+
return _updateResultsByReproduced.apply(this, arguments);
|
|
318
|
+
}
|
|
319
|
+
function readCSVResultData(data) {
|
|
320
|
+
var parsed = Papa.parse(data, {
|
|
321
|
+
header: true,
|
|
322
|
+
skipEmptyLines: true
|
|
323
|
+
});
|
|
324
|
+
if (parsed.errors.length > 0) {
|
|
325
|
+
throw new Error("Error parsing CSV file: ".concat(parsed.errors[0].message));
|
|
326
|
+
}
|
|
327
|
+
return {
|
|
328
|
+
headers: parsed.meta.fields || [],
|
|
329
|
+
rows: parsed.data
|
|
330
|
+
};
|
|
184
331
|
}
|
package/bin/utils/test-utils.js
CHANGED
|
@@ -662,6 +662,7 @@ function _runWorker() {
|
|
|
662
662
|
_context9.next = 22;
|
|
663
663
|
return page.evaluate(function (testData, options) {
|
|
664
664
|
if (options.benchmark) window.DG.Test.isInBenchmark = true;
|
|
665
|
+
if (options.reproduce) window.DG.Test.isReproducing = true;
|
|
665
666
|
return new Promise(function (resolve, reject) {
|
|
666
667
|
window.DG.Utils.executeTests(testData, options.stopOnTimeout).then(function (results) {
|
|
667
668
|
resolve(results);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "datagrok-tools",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.37",
|
|
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": {
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"node-fetch": "^2.7.0",
|
|
18
18
|
"node-recursive-directory": "^1.2.0",
|
|
19
19
|
"os": "^0.1.2",
|
|
20
|
+
"papaparse": "^5.4.1",
|
|
20
21
|
"path": "^0.12.7",
|
|
21
22
|
"puppeteer": "^22.10.0",
|
|
22
23
|
"puppeteer-screen-recorder": "3.0.3"
|
|
@@ -53,6 +54,7 @@
|
|
|
53
54
|
"@types/inquirer": "^8.2.10",
|
|
54
55
|
"@types/js-yaml": "^4.0.9",
|
|
55
56
|
"@types/node": "^16.18.70",
|
|
57
|
+
"@types/papaparse": "^5.3.15",
|
|
56
58
|
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
57
59
|
"@typescript-eslint/parser": "^5.62.0",
|
|
58
60
|
"eslint": "^8.56.0",
|