jaredpalmer / razzle

✨ Create server-rendered universal JavaScript applications with no configuration

Home Page:https://razzlejs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to load `.env.test` with `razzle start`

derweili opened this issue · comments

❓Question

I would like to run Cypress with razzle js. Therefore I followed the instructions from here #1700

My problem is, I would like to use test-specific environment variables. So I added a new .env.test file and tried to load it.
Unfortunatelly, this file will never load outside of the razzle test unit tests.

I tried following script from the mentioned instructions in package.json:

"scripts": {
  "start:test": "NODE_CONFIG_ENV=test razzle start",
},

I also added NODE_ENV

"scripts": {
  "start:test": "NODE_CONFIG_ENV=test NODE_ENV=test razzle start",
},

But the .env.test file never gets loaded.
How can I load this .env.test file when starting or building my razzle app?