From d77b7a298a9723641ae655afb5566489f3f4635a Mon Sep 17 00:00:00 2001 From: Hassy Veldstra Date: Wed, 7 Aug 2024 11:36:05 +0100 Subject: [PATCH] fix: don't print a warning when loadAll is not set (#3303) --- packages/core/lib/runner.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/core/lib/runner.js b/packages/core/lib/runner.js index 32cf88683e..c9d136958a 100644 --- a/packages/core/lib/runner.js +++ b/packages/core/lib/runner.js @@ -407,23 +407,23 @@ function datafileVariables(script) { let result = {}; if (script.config.payload) { _.each(script.config.payload, function (el) { - //when loading all the csv, we don't set individual fields if (!el.loadAll) { + // Load individual fields from the CSV into VU context variables // If data = [] (i.e. the CSV file is empty, or only has headers and // skipHeaders = true), then row could = undefined let row = el.reader(el.data) || []; _.each(el.fields, function (fieldName, j) { result[fieldName] = row[j]; }); - } - - if (typeof el.name !== 'undefined') { - // Make the entire CSV available - result[el.name] = el.reader(el.data); } else { - console.log( - 'WARNING: loadAll is set to true but no name is provided for the CSV data' - ); + if (typeof el.name !== 'undefined') { + // Make the entire CSV available + result[el.name] = el.reader(el.data); + } else { + console.log( + 'WARNING: loadAll is set to true but no name is provided for the CSV data' + ); + } } }); }