datagrok-tools 4.13.23 → 4.13.24
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 +7 -1
- package/bin/commands/test.js +284 -325
- package/bin/utils/test-utils.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/bin/commands/test.js
CHANGED
|
@@ -8,7 +8,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.test = test;
|
|
9
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
-
var _child_process = require("child_process");
|
|
12
11
|
var _fs = _interopRequireDefault(require("fs"));
|
|
13
12
|
var _os = _interopRequireDefault(require("os"));
|
|
14
13
|
var _path = _interopRequireDefault(require("path"));
|
|
@@ -22,342 +21,302 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
22
21
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
23
22
|
/* eslint-disable max-len */
|
|
24
23
|
|
|
25
|
-
|
|
24
|
+
var testInvocationTimeout = 3600000;
|
|
25
|
+
var availableCommandOptions = ['host', 'package', 'csv', 'gui', 'catchUnhandled', 'platform', 'core', 'report', 'skip-build', 'skip-publish', 'path', 'record', 'verbose', 'benchmark', 'category', 'test', 'stress-test', 'link', 'tag'];
|
|
26
|
+
var curDir = process.cwd();
|
|
27
|
+
var grokDir = _path["default"].join(_os["default"].homedir(), '.grok');
|
|
28
|
+
var confPath = _path["default"].join(grokDir, 'config.yaml');
|
|
29
|
+
var consoleLogOutputDir = _path["default"].join(curDir, 'test-console-output.log');
|
|
30
|
+
var browser;
|
|
31
|
+
var page;
|
|
32
|
+
var recorder;
|
|
33
|
+
function test(_x) {
|
|
34
|
+
return _test.apply(this, arguments);
|
|
35
|
+
}
|
|
36
|
+
function _test() {
|
|
37
|
+
_test = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(args) {
|
|
38
|
+
var config, packageJsonData, packageName, packagesDir, categoryToCheck, testToCheck, failed;
|
|
39
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
40
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
41
|
+
case 0:
|
|
42
|
+
config = _jsYaml["default"].load(_fs["default"].readFileSync(confPath, {
|
|
43
|
+
encoding: 'utf-8'
|
|
44
|
+
}));
|
|
45
|
+
isArgsValid(args);
|
|
46
|
+
utils.setHost(args.host, config);
|
|
47
|
+
packageJsonData = JSON.parse(_fs["default"].readFileSync(_path["default"].join(curDir, 'package.json'), {
|
|
48
|
+
encoding: 'utf-8'
|
|
49
|
+
}));
|
|
50
|
+
packageName = args["package"] ? utils.kebabToCamelCase(args["package"]) : utils.kebabToCamelCase(utils.removeScope(packageJsonData.name));
|
|
51
|
+
packagesDir = _path["default"].basename(curDir) === "packages" ? _path["default"].dirname(curDir) : 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
|
+
console.log('Environment variable `TARGET_PACKAGE` is set to', packageName);
|
|
59
|
+
if (args.platform && packageName !== 'ApiTests') color.warn('--platform flag can only be used in the ApiTests package');
|
|
60
|
+
if (args.core && packageName !== 'DevTools') color.warn('--core flag can only be used in the DevTools package');
|
|
61
|
+
if (args["package"]) {
|
|
62
|
+
_context2.next = 15;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
_context2.next = 15;
|
|
66
|
+
return testUtils.loadPackages(packagesDir, packageName, args.host, args['skip-publish'], args['skip-build'], args.link);
|
|
67
|
+
case 15:
|
|
68
|
+
process.env.TARGET_PACKAGE = packageName;
|
|
69
|
+
_context2.next = 18;
|
|
70
|
+
return runTesting(args, categoryToCheck, testToCheck);
|
|
71
|
+
case 18:
|
|
72
|
+
failed = _context2.sent;
|
|
73
|
+
if (failed) testUtils.exitWithCode(1);else testUtils.exitWithCode(0);
|
|
74
|
+
return _context2.abrupt("return", true);
|
|
75
|
+
case 21:
|
|
76
|
+
case "end":
|
|
77
|
+
return _context2.stop();
|
|
78
|
+
}
|
|
79
|
+
}, _callee2);
|
|
80
|
+
}));
|
|
81
|
+
return _test.apply(this, arguments);
|
|
82
|
+
}
|
|
83
|
+
function isArgsValid(args) {
|
|
26
84
|
var options = Object.keys(args).slice(1);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var curDir = process.cwd();
|
|
30
|
-
var grokDir = _path["default"].join(_os["default"].homedir(), '.grok');
|
|
31
|
-
var confPath = _path["default"].join(grokDir, 'config.yaml');
|
|
32
|
-
if (nArgs > 1 || options.length > commandOptions.length || options.length > 0 && !options.every(function (op) {
|
|
33
|
-
return commandOptions.includes(op);
|
|
85
|
+
if (args['_'].length > 1 || options.length > availableCommandOptions.length || options.length > 0 && !options.every(function (op) {
|
|
86
|
+
return availableCommandOptions.includes(op);
|
|
34
87
|
})) return false;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
console.log('Environment variable `TARGET_PACKAGE` is set to', process.env.TARGET_PACKAGE);
|
|
81
|
-
if (args.platform && process.env.TARGET_PACKAGE !== 'ApiTests') {
|
|
82
|
-
color.error('--platform flag can only be used in the ApiTests package');
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
if (args.core && process.env.TARGET_PACKAGE !== 'DevTools') {
|
|
86
|
-
color.error('--core flag can only be used in the DevTools package');
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
if (args['skip-publish'] || args["package"]) {
|
|
90
|
-
test();
|
|
91
|
-
} else {
|
|
92
|
-
if (args['skip-build']) {
|
|
93
|
-
publish(test);
|
|
94
|
-
} else {
|
|
95
|
-
build(function () {
|
|
96
|
-
return publish(test);
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
function build(callback) {
|
|
101
|
-
(0, _child_process.exec)('npm run build', function (err, stdout, stderr) {
|
|
102
|
-
color.info("Building package...");
|
|
103
|
-
if (err) {
|
|
104
|
-
console.log(stdout);
|
|
105
|
-
throw err;
|
|
106
|
-
} else {
|
|
107
|
-
console.log(stdout);
|
|
108
|
-
color.warn(stderr);
|
|
109
|
-
}
|
|
110
|
-
callback();
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
function publish(callback) {
|
|
114
|
-
(0, _child_process.exec)("grok publish ".concat(process.platform === 'win32' ? '%HOST%' : '${HOST}'), function (err, stdout, stderr) {
|
|
115
|
-
color.info("Publishing package \"".concat(process.env.TARGET_PACKAGE, "\" to ").concat(process.env.HOST, "..."));
|
|
116
|
-
if (err) throw err;else {
|
|
117
|
-
console.log(stdout);
|
|
118
|
-
color.warn(stderr);
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
function runTesting(_x2, _x3, _x4) {
|
|
91
|
+
return _runTesting.apply(this, arguments);
|
|
92
|
+
}
|
|
93
|
+
function _runTesting() {
|
|
94
|
+
_runTesting = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(args, categoryToCheck, testToCheck) {
|
|
95
|
+
var r;
|
|
96
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
97
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
98
|
+
case 0:
|
|
99
|
+
color.info('Starting tests...');
|
|
100
|
+
_context3.next = 3;
|
|
101
|
+
return runTests(testInvocationTimeout, {
|
|
102
|
+
path: args.path,
|
|
103
|
+
verbose: args.verbose,
|
|
104
|
+
platform: args.platform,
|
|
105
|
+
catchUnhandled: args.catchUnhandled,
|
|
106
|
+
report: args.report,
|
|
107
|
+
record: args.record,
|
|
108
|
+
benchmark: args.benchmark,
|
|
109
|
+
core: args.core,
|
|
110
|
+
category: categoryToCheck,
|
|
111
|
+
test: testToCheck,
|
|
112
|
+
stressTest: args['stress-test'],
|
|
113
|
+
gui: args.gui
|
|
114
|
+
});
|
|
115
|
+
case 3:
|
|
116
|
+
r = _context3.sent;
|
|
117
|
+
printResults(r, args.csv, args.verbose);
|
|
118
|
+
//@ts-ignore
|
|
119
|
+
if (!(browser != null)) {
|
|
120
|
+
_context3.next = 8;
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
_context3.next = 8;
|
|
124
|
+
return browser.close();
|
|
125
|
+
case 8:
|
|
126
|
+
return _context3.abrupt("return", r.failed);
|
|
127
|
+
case 9:
|
|
128
|
+
case "end":
|
|
129
|
+
return _context3.stop();
|
|
119
130
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
var
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
_context.t0 = _context["catch"](0);
|
|
150
|
-
throw _context.t0;
|
|
151
|
-
case 12:
|
|
152
|
-
case "end":
|
|
153
|
-
return _context.stop();
|
|
131
|
+
}, _callee3);
|
|
132
|
+
}));
|
|
133
|
+
return _runTesting.apply(this, arguments);
|
|
134
|
+
}
|
|
135
|
+
function runTests(timeout) {
|
|
136
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
137
|
+
return testUtils.timeout( /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
138
|
+
var params, out, addLogsToFile;
|
|
139
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
140
|
+
while (1) switch (_context.prev = _context.next) {
|
|
141
|
+
case 0:
|
|
142
|
+
addLogsToFile = function _addLogsToFile(msg) {
|
|
143
|
+
_fs["default"].appendFileSync(consoleLogOutputDir, "".concat(msg));
|
|
144
|
+
};
|
|
145
|
+
params = Object.assign({}, testUtils.defaultLaunchParameters);
|
|
146
|
+
if (options.gui) params['headless'] = false;
|
|
147
|
+
_context.next = 5;
|
|
148
|
+
return testUtils.getBrowserPage(_puppeteer["default"], params);
|
|
149
|
+
case 5:
|
|
150
|
+
out = _context.sent;
|
|
151
|
+
browser = out.browser;
|
|
152
|
+
page = out.page;
|
|
153
|
+
recorder = new _puppeteerScreenRecorder.PuppeteerScreenRecorder(page, testUtils.recorderConfig);
|
|
154
|
+
_context.next = 11;
|
|
155
|
+
return page.exposeFunction("addLogsToFile", addLogsToFile);
|
|
156
|
+
case 11:
|
|
157
|
+
if (!options.record) {
|
|
158
|
+
_context.next = 18;
|
|
159
|
+
break;
|
|
154
160
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
161
|
+
_fs["default"].writeFileSync(consoleLogOutputDir, "");
|
|
162
|
+
_context.next = 15;
|
|
163
|
+
return recorder.start('./test-record.mp4');
|
|
164
|
+
case 15:
|
|
165
|
+
page.on('console', function (msg) {
|
|
166
|
+
addLogsToFile("CONSOLE LOG ENTRY: ".concat(msg.text(), "\n"));
|
|
167
|
+
});
|
|
168
|
+
page.on('pageerror', function (error) {
|
|
169
|
+
addLogsToFile("CONSOLE LOG ERROR: ".concat(error.message, "\n"));
|
|
170
|
+
});
|
|
171
|
+
page.on('response', function (response) {
|
|
172
|
+
addLogsToFile("CONSOLE LOG REQUEST: ".concat(response.status(), ", ").concat(response.url(), "\n"));
|
|
173
|
+
});
|
|
174
|
+
case 18:
|
|
175
|
+
_context.next = 20;
|
|
176
|
+
return runWorker(options);
|
|
177
|
+
case 20:
|
|
178
|
+
return _context.abrupt("return", _context.sent);
|
|
179
|
+
case 21:
|
|
180
|
+
case "end":
|
|
181
|
+
return _context.stop();
|
|
182
|
+
}
|
|
183
|
+
}, _callee);
|
|
184
|
+
})), timeout);
|
|
185
|
+
}
|
|
186
|
+
function runWorker() {
|
|
187
|
+
return _runWorker.apply(this, arguments);
|
|
188
|
+
}
|
|
189
|
+
function _runWorker() {
|
|
190
|
+
_runWorker = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
191
|
+
var _process$env$TARGET_P;
|
|
192
|
+
var options,
|
|
193
|
+
targetPackage,
|
|
194
|
+
r,
|
|
195
|
+
_args4 = arguments;
|
|
196
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
197
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
198
|
+
case 0:
|
|
199
|
+
options = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
|
|
200
|
+
targetPackage = (_process$env$TARGET_P = process.env.TARGET_PACKAGE) !== null && _process$env$TARGET_P !== void 0 ? _process$env$TARGET_P : '#{PACKAGE_NAMESPACE}';
|
|
201
|
+
console.log("Testing ".concat(targetPackage, " package...\n"));
|
|
202
|
+
_context4.next = 5;
|
|
203
|
+
return page.evaluate(function (targetPackage, options, testContext) {
|
|
204
|
+
if (options.benchmark) window.DG.Test.isInBenchmark = true;
|
|
205
|
+
return new Promise(function (resolve, reject) {
|
|
206
|
+
var params = {
|
|
207
|
+
testContext: testContext,
|
|
208
|
+
category: options.category,
|
|
209
|
+
test: options.test
|
|
168
210
|
};
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
_context2.next = 11;
|
|
175
|
-
break;
|
|
211
|
+
if (options.stressTest) params.stressTest = options.stressTest;
|
|
212
|
+
if (options.path) {
|
|
213
|
+
var split = options.path.split(' -- ');
|
|
214
|
+
params.category = split[0];
|
|
215
|
+
params.test = split[1];
|
|
176
216
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
if (
|
|
209
|
-
|
|
210
|
-
|
|
217
|
+
if (targetPackage === 'DevTools') params.skipCore = options.core ? false : true;
|
|
218
|
+
params.verbose = options.verbose === true;
|
|
219
|
+
window.grok.functions.call("".concat(targetPackage, ":").concat(options.platform ? 'testPlatform' : 'test'), params).then(function (df) {
|
|
220
|
+
var failed = false;
|
|
221
|
+
var skipReport = '';
|
|
222
|
+
var passReport = '';
|
|
223
|
+
var failReport = '';
|
|
224
|
+
var countReport = {
|
|
225
|
+
skip: 0,
|
|
226
|
+
pass: 0
|
|
227
|
+
};
|
|
228
|
+
if (df == null) {
|
|
229
|
+
failed = true;
|
|
230
|
+
failReport = "Fail reason: No package tests found".concat(options.path ? ' for path "' + options.path + '"' : '');
|
|
231
|
+
resolve({
|
|
232
|
+
failReport: failReport,
|
|
233
|
+
skipReport: skipReport,
|
|
234
|
+
passReport: passReport,
|
|
235
|
+
failed: failed,
|
|
236
|
+
countReport: countReport
|
|
237
|
+
});
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
var csv = df.toCsv();
|
|
241
|
+
var cStatus = df.columns.byName('success');
|
|
242
|
+
var cSkipped = df.columns.byName('skipped');
|
|
243
|
+
var cMessage = df.columns.byName('result');
|
|
244
|
+
var cCat = df.columns.byName('category');
|
|
245
|
+
var cName = df.columns.byName('name');
|
|
246
|
+
var cTime = df.columns.byName('ms');
|
|
247
|
+
for (var i = 0; i < df.rowCount; i++) {
|
|
248
|
+
if (cStatus.get(i)) {
|
|
249
|
+
if (cSkipped.get(i)) {
|
|
250
|
+
skipReport += "Test result : Skipped : ".concat(cTime.get(i), " : ").concat(targetPackage, ".").concat(cCat.get(i), ".").concat(cName.get(i), " : ").concat(cMessage.get(i), "\n");
|
|
251
|
+
countReport.skip += 1;
|
|
252
|
+
} else {
|
|
253
|
+
passReport += "Test result : Success : ".concat(cTime.get(i), " : ").concat(targetPackage, ".").concat(cCat.get(i), ".").concat(cName.get(i), " : ").concat(cMessage.get(i), "\n");
|
|
254
|
+
countReport.pass += 1;
|
|
255
|
+
}
|
|
256
|
+
} else {
|
|
257
|
+
failed = true;
|
|
258
|
+
failReport += "Test result : Failed : ".concat(cTime.get(i), " : ").concat(targetPackage, ".").concat(cCat.get(i), ".").concat(cName.get(i), " : ").concat(cMessage.get(i), "\n");
|
|
211
259
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
260
|
+
}
|
|
261
|
+
if (!options.verbose) df.rows.removeWhere(function (r) {
|
|
262
|
+
return r.get('success');
|
|
263
|
+
});
|
|
264
|
+
resolve({
|
|
265
|
+
failReport: failReport,
|
|
266
|
+
skipReport: skipReport,
|
|
267
|
+
passReport: passReport,
|
|
268
|
+
failed: failed,
|
|
269
|
+
csv: csv,
|
|
270
|
+
countReport: countReport
|
|
271
|
+
});
|
|
272
|
+
})["catch"](function (e) {
|
|
273
|
+
var stack = window.DG.Logger.translateStackTrace(e.stack).then(function () {
|
|
274
|
+
resolve({
|
|
275
|
+
failReport: "".concat(e.message, "\n").concat(stack),
|
|
276
|
+
skipReport: '',
|
|
277
|
+
passReport: '',
|
|
278
|
+
failed: true,
|
|
279
|
+
csv: '',
|
|
280
|
+
countReport: {
|
|
218
281
|
skip: 0,
|
|
219
282
|
pass: 0
|
|
220
|
-
};
|
|
221
|
-
if (df == null) {
|
|
222
|
-
failed = true;
|
|
223
|
-
failReport = "Fail reason: No package tests found".concat(options.path ? ' for path "' + options.path + '"' : '');
|
|
224
|
-
resolve({
|
|
225
|
-
failReport: failReport,
|
|
226
|
-
skipReport: skipReport,
|
|
227
|
-
passReport: passReport,
|
|
228
|
-
failed: failed,
|
|
229
|
-
countReport: countReport
|
|
230
|
-
});
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
var cStatus = df.columns.byName('success');
|
|
234
|
-
var cSkipped = df.columns.byName('skipped');
|
|
235
|
-
var cMessage = df.columns.byName('result');
|
|
236
|
-
var cCat = df.columns.byName('category');
|
|
237
|
-
var cName = df.columns.byName('name');
|
|
238
|
-
var cTime = df.columns.byName('ms');
|
|
239
|
-
for (var i = 0; i < df.rowCount; i++) {
|
|
240
|
-
if (cStatus.get(i)) {
|
|
241
|
-
if (cSkipped.get(i)) {
|
|
242
|
-
skipReport += "Test result : Skipped : ".concat(cTime.get(i), " : ").concat(targetPackage, ".").concat(cCat.get(i), ".").concat(cName.get(i), " : ").concat(cMessage.get(i), "\n");
|
|
243
|
-
countReport.skip += 1;
|
|
244
|
-
} else {
|
|
245
|
-
passReport += "Test result : Success : ".concat(cTime.get(i), " : ").concat(targetPackage, ".").concat(cCat.get(i), ".").concat(cName.get(i), " : ").concat(cMessage.get(i), "\n");
|
|
246
|
-
countReport.pass += 1;
|
|
247
|
-
}
|
|
248
|
-
} else {
|
|
249
|
-
failed = true;
|
|
250
|
-
failReport += "Test result : Failed : ".concat(cTime.get(i), " : ").concat(targetPackage, ".").concat(cCat.get(i), ".").concat(cName.get(i), " : ").concat(cMessage.get(i), "\n");
|
|
251
|
-
}
|
|
252
283
|
}
|
|
253
|
-
if (!options.verbose) df.rows.removeWhere(function (r) {
|
|
254
|
-
return r.get('success');
|
|
255
|
-
});
|
|
256
|
-
var csv = df.toCsv();
|
|
257
|
-
resolve({
|
|
258
|
-
failReport: failReport,
|
|
259
|
-
skipReport: skipReport,
|
|
260
|
-
passReport: passReport,
|
|
261
|
-
failed: failed,
|
|
262
|
-
csv: csv,
|
|
263
|
-
countReport: countReport
|
|
264
|
-
});
|
|
265
|
-
})["catch"](function (e) {
|
|
266
|
-
var stack = window.DG.Logger.translateStackTrace(e.stack).then(function () {
|
|
267
|
-
resolve({
|
|
268
|
-
failReport: "".concat(e.message, "\n").concat(stack),
|
|
269
|
-
skipReport: '',
|
|
270
|
-
passReport: '',
|
|
271
|
-
failed: true,
|
|
272
|
-
csv: '',
|
|
273
|
-
countReport: {
|
|
274
|
-
skip: 0,
|
|
275
|
-
pass: 0
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
|
-
});
|
|
279
284
|
});
|
|
280
285
|
});
|
|
281
|
-
}
|
|
282
|
-
case 15:
|
|
283
|
-
r = _context2.sent;
|
|
284
|
-
if (!options.record) {
|
|
285
|
-
_context2.next = 19;
|
|
286
|
-
break;
|
|
287
|
-
}
|
|
288
|
-
_context2.next = 19;
|
|
289
|
-
return recorder.stop();
|
|
290
|
-
case 19:
|
|
291
|
-
return _context2.abrupt("return", r);
|
|
292
|
-
case 20:
|
|
293
|
-
case "end":
|
|
294
|
-
return _context2.stop();
|
|
295
|
-
}
|
|
296
|
-
}, _callee2);
|
|
297
|
-
})), timeout);
|
|
298
|
-
}
|
|
299
|
-
(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
300
|
-
var r;
|
|
301
|
-
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
302
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
303
|
-
case 0:
|
|
304
|
-
_context3.prev = 0;
|
|
305
|
-
_context3.next = 3;
|
|
306
|
-
return init(P_START_TIMEOUT);
|
|
307
|
-
case 3:
|
|
308
|
-
color.success('Initialization completed.');
|
|
309
|
-
_context3.next = 10;
|
|
310
|
-
break;
|
|
311
|
-
case 6:
|
|
312
|
-
_context3.prev = 6;
|
|
313
|
-
_context3.t0 = _context3["catch"](0);
|
|
314
|
-
color.error('Initialization failed.');
|
|
315
|
-
throw _context3.t0;
|
|
316
|
-
case 10:
|
|
317
|
-
_context3.next = 12;
|
|
318
|
-
return runTest(3600000, {
|
|
319
|
-
path: args.path,
|
|
320
|
-
verbose: args.verbose,
|
|
321
|
-
platform: args.platform,
|
|
322
|
-
catchUnhandled: args.catchUnhandled,
|
|
323
|
-
report: args.report,
|
|
324
|
-
record: args.record,
|
|
325
|
-
benchmark: args.benchmark,
|
|
326
|
-
core: args.core,
|
|
327
|
-
category: categoryToCheck,
|
|
328
|
-
test: testToCheck,
|
|
329
|
-
stressTest: args['stress-test']
|
|
286
|
+
});
|
|
330
287
|
});
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
288
|
+
}, targetPackage, options, new testUtils.TestContext(options.catchUnhandled, options.report));
|
|
289
|
+
case 5:
|
|
290
|
+
r = _context4.sent;
|
|
291
|
+
if (!options.record) {
|
|
292
|
+
_context4.next = 9;
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
_context4.next = 9;
|
|
296
|
+
return recorder.stop();
|
|
297
|
+
case 9:
|
|
298
|
+
return _context4.abrupt("return", r);
|
|
299
|
+
case 10:
|
|
300
|
+
case "end":
|
|
301
|
+
return _context4.stop();
|
|
302
|
+
}
|
|
303
|
+
}, _callee4);
|
|
304
|
+
}));
|
|
305
|
+
return _runWorker.apply(this, arguments);
|
|
306
|
+
}
|
|
307
|
+
function printResults(results) {
|
|
308
|
+
var csv = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
309
|
+
var verbose = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
310
|
+
if (results.csv && csv) {
|
|
311
|
+
_fs["default"].writeFileSync(_path["default"].join(curDir, 'test-report.csv'), results.csv, 'utf8');
|
|
312
|
+
color.info('Saved `test-report.csv`\n');
|
|
313
|
+
}
|
|
314
|
+
if (results.passReport && verbose) console.log(results.passReport);else console.log('Passed tests: ' + results.countReport.pass);
|
|
315
|
+
if (results.skipReport && verbose) console.log(results.skipReport);else console.log('Skipped tests: ' + results.countReport.skip);
|
|
316
|
+
if (results.failed) {
|
|
317
|
+
console.log(results.failReport);
|
|
318
|
+
color.fail('Tests failed.');
|
|
319
|
+
} else {
|
|
320
|
+
color.success('Tests passed.');
|
|
361
321
|
}
|
|
362
|
-
return true;
|
|
363
322
|
}
|
package/bin/utils/test-utils.js
CHANGED
|
@@ -394,14 +394,14 @@ function _loadPackages() {
|
|
|
394
394
|
case 30:
|
|
395
395
|
_context6.prev = 30;
|
|
396
396
|
_context6.t0 = _context6["catch"](14);
|
|
397
|
-
console.log("Package
|
|
397
|
+
console.log("Package wasn't published ".concat(dirName));
|
|
398
398
|
case 33:
|
|
399
399
|
_context6.next = 38;
|
|
400
400
|
break;
|
|
401
401
|
case 35:
|
|
402
402
|
_context6.prev = 35;
|
|
403
403
|
_context6.t1 = _context6["catch"](10);
|
|
404
|
-
if (utils.isPackageDir(packageDir) && (packagesToRun.get((0, _utils.spaceToCamelCase)(dirName).toLocaleLowerCase()) !== undefined || packagesToLoad === "all")) console.log("
|
|
404
|
+
if (utils.isPackageDir(packageDir) && (packagesToRun.get((0, _utils.spaceToCamelCase)(dirName).toLocaleLowerCase()) !== undefined || packagesToLoad === "all")) console.log("Couldn't read package.json ".concat(dirName));
|
|
405
405
|
case 38:
|
|
406
406
|
_context6.next = 6;
|
|
407
407
|
break;
|
package/package.json
CHANGED