Newman doesn't seem to like code libraries set in globals

Hello, I use collection runner in my daily job but as postman have recently done a shake up and locked the collection runner behind a higher paywall I was suggested by support to run my collections through postman CLI or newmanā€¦ due to security protocols in my company blocking postman CLI i install newman instead.

I canā€™t seem to get my collections running with all of my code though, let me try to briefly explain what happens in my collection runs.

I have a library of functions saved to my global, this is code that does things with variables that come in from a csv files in the pre-req eg. takes partial postcodes and turns them into full postcodes then saves them to globals for use in the requestsā€¦ then i have code in the test script section that builds tests based on variables that come through on the csvā€¦ this all works fine on postman itself.

so in that second example the code in my tests section is just this:

const lib = eval(globals.loadLib);

lib.jsonOrXML();

lib.tests();

it then uses these functions that have been evalā€™d from globals, to build all the tests needed at run time.

In newman i have downloaded the collection.JSON and the globals.JSON and provide it with the csv neededā€¦ here is the command i run:

newman run ā€œBG.JSONā€ -d ā€œBG.CSVā€ -g ā€œglobals.JSONā€

but it doesnā€™t seem to be able to see my lib from the globalsā€¦ i get type errors saying the following:

Cannot read properties of undefined (reading ā€˜jsonOrXMLā€™)
iteration: 110 at test-script

if i comment out the jsonOrXML function, it then has the same error but for ā€œtestsā€ā€¦

this says to me its not able to read the functions saved on the lib constantā€¦ am i doing something wrong here? sorry if its not explained very well, i can answer further questions