@artilleryio/int-core 2.13.0 → 2.14.0-d77b7a2
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/lib/runner.js +21 -10
- package/package.json +2 -2
package/lib/runner.js
CHANGED
|
@@ -18,6 +18,7 @@ const isIdlePhase = require('./is-idle-phase');
|
|
|
18
18
|
const createReader = require('./readers');
|
|
19
19
|
const engineUtil = require('@artilleryio/int-commons').engine_util;
|
|
20
20
|
const wl = require('./weighted-pick');
|
|
21
|
+
const { pathToFileURL } = require('url');
|
|
21
22
|
|
|
22
23
|
const Engines = {
|
|
23
24
|
http: require('./engine_http'),
|
|
@@ -86,7 +87,8 @@ async function loadProcessor(script, options) {
|
|
|
86
87
|
);
|
|
87
88
|
|
|
88
89
|
if (processorPath.endsWith('.mjs')) {
|
|
89
|
-
const
|
|
90
|
+
const fileUrl = pathToFileURL(processorPath);
|
|
91
|
+
const exports = await import(fileUrl.href);
|
|
90
92
|
script.config.processor = Object.assign(
|
|
91
93
|
{},
|
|
92
94
|
script.config.processor,
|
|
@@ -405,18 +407,27 @@ function datafileVariables(script) {
|
|
|
405
407
|
let result = {};
|
|
406
408
|
if (script.config.payload) {
|
|
407
409
|
_.each(script.config.payload, function (el) {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
410
|
+
if (!el.loadAll) {
|
|
411
|
+
// Load individual fields from the CSV into VU context variables
|
|
412
|
+
// If data = [] (i.e. the CSV file is empty, or only has headers and
|
|
413
|
+
// skipHeaders = true), then row could = undefined
|
|
414
|
+
let row = el.reader(el.data) || [];
|
|
415
|
+
_.each(el.fields, function (fieldName, j) {
|
|
416
|
+
result[fieldName] = row[j];
|
|
417
|
+
});
|
|
418
|
+
} else {
|
|
419
|
+
if (typeof el.name !== 'undefined') {
|
|
420
|
+
// Make the entire CSV available
|
|
421
|
+
result[el.name] = el.reader(el.data);
|
|
422
|
+
} else {
|
|
423
|
+
console.log(
|
|
424
|
+
'WARNING: loadAll is set to true but no name is provided for the CSV data'
|
|
425
|
+
);
|
|
426
|
+
}
|
|
417
427
|
}
|
|
418
428
|
});
|
|
419
429
|
}
|
|
430
|
+
|
|
420
431
|
return result;
|
|
421
432
|
}
|
|
422
433
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@artilleryio/int-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.0-d77b7a2",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@artilleryio/int-commons": "2.
|
|
7
|
+
"@artilleryio/int-commons": "2.10.0-d77b7a2",
|
|
8
8
|
"@artilleryio/sketches-js": "^2.1.1",
|
|
9
9
|
"agentkeepalive": "^4.1.0",
|
|
10
10
|
"arrivals": "^2.1.2",
|