@artilleryio/int-core 2.13.0-c69bc00 → 2.13.0-e1fa2a7

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.
Files changed (2) hide show
  1. package/lib/runner.js +18 -7
  2. 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 exports = await import(processorPath);
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
- // If data = [] (i.e. the CSV file is empty, or only has headers and
409
- // skipHeaders = true), then row could = undefined
410
- let row = el.reader(el.data) || [];
411
- _.each(el.fields, function (fieldName, j) {
412
- result[fieldName] = row[j];
413
- });
410
+ //when loading all the csv, we don't set individual fields
411
+ if (!el.loadAll) {
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
+ }
419
+
414
420
  if (typeof el.name !== 'undefined') {
415
421
  // Make the entire CSV available
416
422
  result[el.name] = el.reader(el.data);
423
+ } else {
424
+ console.log(
425
+ 'WARNING: loadAll is set to true but no name is provided for the CSV data'
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.13.0-c69bc00",
3
+ "version": "2.13.0-e1fa2a7",
4
4
  "main": "./index.js",
5
5
  "license": "MPL-2.0",
6
6
  "dependencies": {
7
- "@artilleryio/int-commons": "2.9.0-c69bc00",
7
+ "@artilleryio/int-commons": "2.9.0-e1fa2a7",
8
8
  "@artilleryio/sketches-js": "^2.1.1",
9
9
  "agentkeepalive": "^4.1.0",
10
10
  "arrivals": "^2.1.2",