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

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?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source