I am running some UI tests using WebdriverIO using npm.
My .env
file:
VARIABLE=SOME-VALUE
package.json
:
"scripts": {
"test": "dotenv -e .env tsc && wdio wdio.conf.ts"
},
How I am accessing the variable:
const myVariable = process.env.VARIABLE
All three files are in same directory. When I console log the myVariable
, i get undefined
.
I am not getting what is missing. I referred few answers here, but they are not helping.
Also, if someone could throw light on do we need to/how to import the file. I am fairly new to this, hence any help would be appreciated.