How do I import variables from .env in Intellij IDEA Protractor (JS) debug? - intellij-idea

I have recently introduced a .env file to a Typescript Protractor project. I installed dotenv package, and run dotenv.config() at the very top of the protractor config file. When executed from console, all works as expected, .env is loaded, everyone's happy.
However when I execute from IntelliJ IDEA's debug tool (configured for Protractor), the .env file doesn't load - even though the code goes through dotenv.config().
I can work around by setting env variables in the debug config, but that has to be done manually, and I would prefer to source these values from the .env file automatically (source .env in a "before launch" script doesn't help either).
Can this be done using just Cucumber.js package? If not, which package would help?

Related

'Cypress Config File does not exist' - Lambdatest can't see cypress configuration file

I've got installed Cypress on my Vue project and created just a few simple tests that perform great when I run Cypress with this command npx cypress open.
I am trying to implement automatisation with the help of Lambdatest but when I run command lambdatest-cypress run I receive this message in return:
Checking Lambda Config in current directory
Validating CLI
validating config
Error!! Cypress Config File does not exist
I have installed Lambdatest cli globally, added lambdatest-config.json in the root of my project, and updated "lambdatest_auth" data in this file. Also I've got cypress.config.js on the same root level in project's directory. Cypress's config file does not show any errors excluding eslint saying that
on this part
setupNodeEvents(on, config) {
// implement node event listeners here
},
on and config are declared but never used.
Do you have any ideas why I can not run this one using Lambdatest?
As always maybe someone will find it useful.
So... it would seem that in some cases lambdatest get's a little bit lost and it's config is not filled with the things it should be :)
The solution was to remove this line of code in lambdatest-config.json file which is located in the project root directory.
"cypress_config_file": "cypress.config.js", <-- remove this line

Multiple config files in Cypress 10?

I am currently running my E2E tests in multiple environments. To achieve this, I have created a config file for each environment and passed the configFile value in the CLI. When upgrading, I realized Cypress 10.0.0 does not support multiple config files. Is there a way to achieve this in the latest version of Cypress?
The --configFile option does not seem to have changed
Ref
Specifying an Alternative Config File
In the Cypress CLI, you can change which config file Cypress will use with the --config-file flag.
cypress run --config-file tests/cypress.config.js
Did you have another use in mind?

Vue.js: To Get Environment Variables in js File

I have created .env file to set environment variables as shown below:
Inside which I have given below mentioned code.
VUE_APP_BASEURL="https://qa-apps-nodejs.Dtech.com:9000/"
PORT=8080
I have written below code in my js file and executed npm install dotenv:
require('dotenv').config();
console.log(process.env.VUE_APP_BASEURL);
With the above code, I need to get https://qa-apps-nodejs.Dtech.com:9000/ in console. But instead I'm getting:
undefined
Just restart your server as newly created env variables are not available only after hot-reload you have to rebuild your application (restart your server). For reference you can look here
No need to install "dotenv" simply place .env file in the root of your project (at the same level of your package.json file) and Vue CLI will handle the reset. Side note; as of Vue CLI 3 only variables that start with VUE_APP_ will be loaded. make sure also to rerun npm run serve again to restart your server.
for more details: visit docs

Missing .env in Vue CLI after run build

I'm building an app using Vue CLI 3.
I've included .env in my project and everything works fine.
But when i'm building the app for production via npm run build there is no .env file in my dist folder, so i can't change my environmental variables in production server.
Any solution or it's just fine?
This is supposed to happen. The env variables are embedded in your build.
You can make seperate .env files for production. These variables will be used during the production build.
Create a new .env file named: .env.production
Source: https://cli.vuejs.org/guide/mode-and-env.html#modes
It is normal because application needed to be recompiled when .env file changed.
For convenience you can use .env.prod or .env.dev for your CI/CD pipeline.

Setup custom config.json location for Grunt tasks in IntelliJ IDEA

I want to run my Grunt tasks (through a GruntFile.js file) in my IntelliJ IDEA. However, the config.json is located somewhere else which is causing the loading of the GruntFile.js to crash.
Is there a way to set the –-config.json parameter? Or is there a work around? It seems that I only can configure the environment variables and node options.
We configured a custom environment variable. It works beautifully.
grunt.option('config.json') || process.env.BS_CONFIG_JSON|| 'build/config.json'