From 7c544e9d722705ab1b486302f2968438d2046fc2 Mon Sep 17 00:00:00 2001 From: Vijet M Date: Wed, 11 Sep 2019 13:42:45 -0700 Subject: [PATCH] Updates config to use testenv only if it exists (#248) --- test/app/webpack.config.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/app/webpack.config.js b/test/app/webpack.config.js index 6d15def99..a3e3af280 100644 --- a/test/app/webpack.config.js +++ b/test/app/webpack.config.js @@ -4,10 +4,14 @@ const fs = require('fs'); const path = require('path'); // Read environment variables from "testenv". Override environment vars if they are already set. -const envConfig = dotenv.parse(fs.readFileSync(path.resolve(__dirname, '../..', 'testenv'))); -Object.keys(envConfig).forEach((k) => { - process.env[k] = envConfig[k]; -}); +const TESTENV = path.resolve(__dirname, '../..', 'testenv'); + +if (fs.existsSync(TESTENV)) { + const envConfig = dotenv.parse(fs.readFileSync(TESTENV)); + Object.keys(envConfig).forEach((k) => { + process.env[k] = envConfig[k]; + }); +} var webpack = require('webpack'); const ROOT_DIR = path.resolve(__dirname, '..', '..');