From 3107ae6da0dee1012ecfda847067891cea840130 Mon Sep 17 00:00:00 2001 From: kgpyo Date: Tue, 17 Dec 2019 16:11:37 +0900 Subject: [PATCH] fix: configure elasticsearch to stop when testing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 테스트를 진행할때 순수 함수 테스트이므로 elastic search에 연결하는 과정 제거 --- apis/product/config/index.js | 2 +- apis/product/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apis/product/config/index.js b/apis/product/config/index.js index 6ef7595..d290792 100644 --- a/apis/product/config/index.js +++ b/apis/product/config/index.js @@ -1,4 +1,4 @@ -export const mongoosasticSettings = { +export const mongoosasticSettings = (process.env.NODE_ENV === 'test') ? {} : { hosts: process.env.ELASTICSEARCH, port: process.env.ESPORT, bulk: { diff --git a/apis/product/package.json b/apis/product/package.json index 4378778..4673bad 100644 --- a/apis/product/package.json +++ b/apis/product/package.json @@ -9,7 +9,7 @@ ] }, "scripts": { - "test": "jest --runInBand --setupFiles dotenv/config --forceExit", + "test": "NODE_ENV=test jest --runInBand --setupFiles dotenv/config --forceExit", "precommit": "lint-staged && yarn test", "dev:start": "nodemon --exec babel-node bin/www.js", "build": "babel ./ -d build --copy-files '*.json'",