picosam
03/22/2018, 1:15 PM.env
file before. Any idea what the node options I could provide would be, to load dotenv before running Jest?nilan
03/22/2018, 1:26 PMpicosam
03/22/2018, 1:28 PMimport * as dotenv from 'dotenv'
then running dotenv.load()
picosam
03/22/2018, 1:28 PM"test": "dotenv jest"
which works wellpicosam
03/22/2018, 1:29 PMnilan
03/22/2018, 1:30 PMnilan
03/22/2018, 1:32 PMsource
suggestion?James
03/22/2018, 1:40 PMJames
03/22/2018, 1:40 PMharmony
03/22/2018, 2:20 PMharmony
03/22/2018, 2:20 PMharmony
03/22/2018, 2:20 PMpicosam
03/22/2018, 2:40 PMpicosam
03/22/2018, 2:41 PMmax
03/22/2018, 3:37 PM"test": "dotenv -e config/test.env jest",
in my package.json scripts sectionpicosam
03/22/2018, 3:40 PM”dotenv jest”
simply works. But I also found a way around the WebStorm issue. As I said, I’ll try and put this together on a repository next week.lawjolla
03/22/2018, 3:43 PMrequire('dotenv').config()
and it all works 🙂 I use that a lot with QuokkaJS (big recommendation if you haven't taken a look at it -- it's a scratch file runtime that can also run real files)lawjolla
03/22/2018, 3:45 PMlawjolla
03/22/2018, 3:52 PMpicosam
03/22/2018, 4:43 PMrequire('dotenv').config()
wasn’t working at first was simply because the current working directory was incorrectly set by WebStormpicosam
03/22/2018, 4:44 PMglobalSetup
and loading it this way after all. I’ll try and put references to GitHub issues that explain why, for instance, I use JavaScript for globalSetup though I’m using TypeScript for everything else!picosam
03/28/2018, 8:57 PMnilan
03/29/2018, 8:44 AMnilan
03/29/2018, 8:47 AM