My question:
Hi I tried to pass some environment variable via command line to my node.js + newman script. But didnโt get it working, could someone please help me here?
Details (like screenshots):
My run.js as below
const newman = require('newman');
const appName = process.env.NAME;
const fileName= `../collection/${appName}-collection.json`
var options ={
collection: require(`${fileName}`),
envrionment: envrionmnet.get(),
reporters:'cli',
envVarโ: โ[โ
{โ โ
"key"โ:โ"env"โ,โ โ
"value"โ:โ`โ${โprocessโ.โenvโ.โENVโ}โ`โ
}โ,
{โ โ
"key"โ:โ"country"โ,โ โ
"value"โ:โ`โ${โprocessโ.โenvโ.โCOUNTRYโ}โ`โ
}โ,
โ ]โ
}
newman.run(options, function(err,summary){
}
where I try to pass the variable in the command line:
NAME=abc ENV=qa COUNTRY=us node scr/run.js
but the environment.json seems not to take these two variables