I am using minimist to run the same testcafe code for different env like a test, stage, Prod. however when the URL is hit it's saying 500 internal error. If I am hitting the Url without using minimist then it's working fine. Please tell me what am I missing
My code:
import * as minimist from 'minimist';
fixture('Verifying')
.beforeEach(async t =>{
console.log("Execution Started ");
const args = minimist(process.argv.slice(2));
var environment = args.env;
if(environment == 'Test')
{
t.ctx.Connectionstring=config.Test.Connectionstring;
t.ctx.Url=config.Test.Url;
}
else if(environment == 'Stage')
{
t.ctx.Connectionstring=config.Stage.Connectionstring;
t.ctx.Url=config.Stage.Url;
}
else if(environment == 'Prod')
{
t.ctx.Connectionstring=config.Prod.Connectionstring;
t.ctx.Url=config.Prod.Url;
}
My config file:
const config = {
"Test":{
"Url": 'abctest.com',
"Connectionstring": '....',
},
"Stage":{
"Url": 'abctest.com',
"Connectionstring": '....',
},
"Prod":{
Url": 'abctest.com',
"Connectionstring": '....',
},
};
export default config;