From cb1500023d04661eb3658aca6ae19f45705adb9d Mon Sep 17 00:00:00 2001 From: alexvndre Date: Mon, 13 Nov 2017 16:48:17 +0100 Subject: [PATCH 01/19] Add travis config --- .travis.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..9c0b5c6 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +node_js: + - "iojs" + - "8" +before_install: + - make install +script: + - make test From a8e6d8a2adce2eede336062e1a944a04e0cdda0f Mon Sep 17 00:00:00 2001 From: alexvndre Date: Mon, 13 Nov 2017 16:57:29 +0100 Subject: [PATCH 02/19] Update travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9c0b5c6..cf5eb32 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: node_js node_js: - "iojs" - "8" -before_install: +before_script: - make install script: - make test From f2d23f479b861ff5298a6f1f9d36710a55b13b4e Mon Sep 17 00:00:00 2001 From: alexvndre Date: Mon, 13 Nov 2017 17:06:59 +0100 Subject: [PATCH 03/19] Update travis node version and add travis badge --- .travis.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index cf5eb32..a0fdfee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: node_js node_js: - "iojs" - - "8" + - "6" before_script: - make install script: diff --git a/README.md b/README.md index c0bb16a..15fbf77 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Express.js starter pack +Express.js starter pack [![Build Status](https://travis-ci.org/alexvndre/expressjs-starter-pack.svg?branch=master)](https://travis-ci.org/alexvndre/expressjs-starter-pack) ====== A ready to use [Express.js](https://expressjs.com) solution. From a771eb0eea937bdb1d97d8939f3453f713bf0082 Mon Sep 17 00:00:00 2001 From: alexvndre Date: Mon, 13 Nov 2017 17:16:21 +0100 Subject: [PATCH 04/19] Update travis --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a0fdfee..cfb7091 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,9 @@ language: node_js node_js: - - "iojs" - "6" -before_script: +env: + - NODE_ENV=test +install: - make install script: - make test From 312f38efc4c56e80c6f7de48053d3ba65a7d020b Mon Sep 17 00:00:00 2001 From: alexvndre Date: Mon, 13 Nov 2017 17:17:54 +0100 Subject: [PATCH 05/19] Update travis --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index cfb7091..67095ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ node_js: - "6" env: - NODE_ENV=test -install: - - make install +before_script: + - cp ./.env.dist ./.env script: - make test From 6d82466007aba8363bc62a5f2a2d406eb256b4c1 Mon Sep 17 00:00:00 2001 From: alexvndre Date: Mon, 13 Nov 2017 17:20:42 +0100 Subject: [PATCH 06/19] Update travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 67095ab..3f94e18 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: node_js node_js: - - "6" + - "8" env: - NODE_ENV=test before_script: From 0f57dd7c957812bf47ac8f6500cfd9cabbc7027d Mon Sep 17 00:00:00 2001 From: alexvndre Date: Tue, 14 Nov 2017 11:01:34 +0100 Subject: [PATCH 07/19] Update es dependency --- .babelrc | 2 +- README.md | 12 +++--------- package.json | 4 +++- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.babelrc b/.babelrc index c13c5f6..002b4aa 100644 --- a/.babelrc +++ b/.babelrc @@ -1,3 +1,3 @@ { - "presets": ["es2015"] + "presets": ["env"] } diff --git a/README.md b/README.md index 15fbf77..d632c6a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ -Express.js starter pack [![Build Status](https://travis-ci.org/alexvndre/expressjs-starter-pack.svg?branch=master)](https://travis-ci.org/alexvndre/expressjs-starter-pack) -====== +# Express.js starter pack + +[![Build Status](https://travis-ci.org/alexvndre/expressjs-starter-pack.svg?branch=master)](https://travis-ci.org/alexvndre/expressjs-starter-pack) A ready to use [Express.js](https://expressjs.com) solution. @@ -42,10 +43,3 @@ You can check that your image is listed by Docker with `$ docker images`. Check if the image is running with `$ docker ps`. You can read the app output with `$ docker logs `. If you need to run an app command, `$ docker exec -it /bin/bash`. To kill it: `$ docker kill `. - -### TODO - -* Command sample ([commander](https://github.com/tj/commander.js)) -* External HTTP calls ([request](https://github.com/request/request)) -* Mock test ([sinon.js](http://sinonjs.org)) -* BDD ([mongodb](https://www.npmjs.com/package/mongodb) and other wrappers) diff --git a/package.json b/package.json index 68f77f7..d5aac1c 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,10 @@ "babel-core": "^6.24.0", "babel-eslint": "^8.0.1", "babel-istanbul": "^0.12.2", - "babel-preset-es2015": "^6.24.0", + "babel-preset-env": "^1.6.1", "chai": "^4.1.2", "chai-http": "^3.0.0", + "coveralls": "^3.0.0", "eslint": "^4.10.0", "eslint-config-airbnb": "^16.1.0", "eslint-plugin-import": "^2.2.0", @@ -35,6 +36,7 @@ "istanbul": "^0.4.5", "mocha": "^4.0.1", "mocha-istanbul": "^0.3.0", + "mocha-lcov-reporter": "^1.3.0", "npm-check-updates": "^2.13.0" }, "scripts": { From da5b14de995a924d312c8a6c977384e86a6b3c94 Mon Sep 17 00:00:00 2001 From: alexvndre Date: Tue, 14 Nov 2017 11:22:14 +0100 Subject: [PATCH 08/19] Rewrite should import --- test/app.js | 4 ++-- test/controller/index.js | 6 ++---- test/controller/v1/resource.js | 14 +++++++------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/test/app.js b/test/app.js index 4e3fbf9..9dd7bc7 100644 --- a/test/app.js +++ b/test/app.js @@ -2,7 +2,7 @@ import chai from 'chai'; import chaiHttp from 'chai-http'; import server from './../src/server'; -const should = chai.should(); +chai.should(); chai.use(chaiHttp); @@ -14,7 +14,7 @@ describe('app', () => { .set('Content-Type', 'application/json') .send('toto') .end((err, res) => { - res.should.have.status(500); + res.status.should.eql(500); res.body.should.have.property('code'); res.body.code.should.eql(500); res.body.should.have.property('message'); diff --git a/test/controller/index.js b/test/controller/index.js index 4625907..76aafe6 100644 --- a/test/controller/index.js +++ b/test/controller/index.js @@ -2,7 +2,7 @@ import chai from 'chai'; import chaiHttp from 'chai-http'; import server from './../../src/server'; -const should = chai.should(); +chai.should(); chai.use(chaiHttp); @@ -13,10 +13,8 @@ describe('controller/index', () => { .get('/not-found-route') .send() .end((err, res) => { - res.should.have.status(404); - res.body.should.have.property('code'); + res.status.should.eql(404); res.body.code.should.eql(404); - res.body.should.have.property('message'); res.body.message.should.eql('Not found'); done(); }); diff --git a/test/controller/v1/resource.js b/test/controller/v1/resource.js index 470701c..17ea4a8 100644 --- a/test/controller/v1/resource.js +++ b/test/controller/v1/resource.js @@ -2,7 +2,7 @@ import chai from 'chai'; import chaiHttp from 'chai-http'; import server from './../../../src/server'; -const should = chai.should(); +chai.should(); chai.use(chaiHttp); @@ -13,7 +13,7 @@ describe('controller/v1/resource', () => { .get('/v1/resources') .send() .end((err, res) => { - res.should.have.status(200); + res.status.should.eql(200); res.body.should.be.a('array'); res.body.forEach((item) => { item.should.be.a('object'); @@ -29,7 +29,7 @@ describe('controller/v1/resource', () => { .set('Content-Type', 'application/json') .send({ test: 'test' }) .end((err, res) => { - res.should.have.status(400); + res.status.should.eql(400); res.body.should.be.a('array'); res.body[0].should.have.property('code'); res.body[0].should.have.property('message'); @@ -46,7 +46,7 @@ describe('controller/v1/resource', () => { .set('Content-Type', 'application/json') .send({ name: 'test' }) .end((err, res) => { - res.should.have.status(201); + res.status.should.eql(201); res.body.should.be.a('object'); res.body.should.have.property('id'); res.body.should.have.property('name'); @@ -61,7 +61,7 @@ describe('controller/v1/resource', () => { .get('/v1/resources/1') .send() .end((err, res) => { - res.should.have.status(200); + res.status.should.eql(200); res.body.should.be.a('object'); res.body.should.have.property('id'); res.body.should.have.property('name'); @@ -76,7 +76,7 @@ describe('controller/v1/resource', () => { .put('/v1/resources/1') .send({ name: 'test' }) .end((err, res) => { - res.should.have.status(200); + res.status.should.eql(200); res.body.should.be.a('object'); res.body.should.have.property('id'); res.body.should.have.property('name'); @@ -91,7 +91,7 @@ describe('controller/v1/resource', () => { .delete('/v1/resources/1') .send() .end((err, res) => { - res.should.have.status(204); + res.status.should.eql(204); done(); }); }); From 15b75c59eff3b26a293115c7ce9b8b26e50a7391 Mon Sep 17 00:00:00 2001 From: alexvndre Date: Tue, 14 Nov 2017 11:23:59 +0100 Subject: [PATCH 09/19] Missing mocha imports --- test/app.js | 1 + test/controller/index.js | 1 + test/controller/v1/resource.js | 1 + 3 files changed, 3 insertions(+) diff --git a/test/app.js b/test/app.js index 9dd7bc7..ffbb942 100644 --- a/test/app.js +++ b/test/app.js @@ -1,3 +1,4 @@ +import { describe, it } from 'mocha'; import chai from 'chai'; import chaiHttp from 'chai-http'; import server from './../src/server'; diff --git a/test/controller/index.js b/test/controller/index.js index 76aafe6..e11c61e 100644 --- a/test/controller/index.js +++ b/test/controller/index.js @@ -1,3 +1,4 @@ +import { describe, it } from 'mocha'; import chai from 'chai'; import chaiHttp from 'chai-http'; import server from './../../src/server'; diff --git a/test/controller/v1/resource.js b/test/controller/v1/resource.js index 17ea4a8..67d59db 100644 --- a/test/controller/v1/resource.js +++ b/test/controller/v1/resource.js @@ -1,3 +1,4 @@ +import { describe, it } from 'mocha'; import chai from 'chai'; import chaiHttp from 'chai-http'; import server from './../../../src/server'; From b0e26eeebcbf6ad50c9da4bfee89bc4e6e9e86b5 Mon Sep 17 00:00:00 2001 From: alexvndre Date: Tue, 14 Nov 2017 11:46:59 +0100 Subject: [PATCH 10/19] Add bithound --- .travis.yml | 1 + README.md | 1 + package.json | 1 + 3 files changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 3f94e18..5beaed2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,4 +6,5 @@ env: before_script: - cp ./.env.dist ./.env script: + - ./node_modules/.bin/bithound check git@github.com:alexvndre/expressjs-starter-pack.git - make test diff --git a/README.md b/README.md index d632c6a..bc49b71 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Express.js starter pack [![Build Status](https://travis-ci.org/alexvndre/expressjs-starter-pack.svg?branch=master)](https://travis-ci.org/alexvndre/expressjs-starter-pack) +[![bitHound Overall Score](https://www.bithound.io/github/alexvndre/expressjs-starter-pack/badges/score.svg)](https://www.bithound.io/github/alexvndre/expressjs-starter-pack) A ready to use [Express.js](https://expressjs.com) solution. diff --git a/package.json b/package.json index d5aac1c..ade9ca0 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "babel-eslint": "^8.0.1", "babel-istanbul": "^0.12.2", "babel-preset-env": "^1.6.1", + "bithound": "^1.7.0", "chai": "^4.1.2", "chai-http": "^3.0.0", "coveralls": "^3.0.0", From 02e8715d89ac2bbee7533e5a1c868e00fa9da19c Mon Sep 17 00:00:00 2001 From: alexvndre Date: Tue, 14 Nov 2017 14:37:09 +0100 Subject: [PATCH 11/19] Add coverwalls --- .travis.yml | 1 + Makefile | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5beaed2..4895f17 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ node_js: - "8" env: - NODE_ENV=test + before_script: - cp ./.env.dist ./.env script: diff --git a/Makefile b/Makefile index 9820c01..6d19959 100644 --- a/Makefile +++ b/Makefile @@ -40,9 +40,22 @@ start: ## start the web server test: ## launch tests @echo " > Testing the project" @$(MAKE) -s build - @export PORT=0 && export NODE_ENV=test && $(MOCHA) --require babel-core/register --recursive --exit + @export PORT=0 && \ + export NODE_ENV=test && \ + $(MOCHA) --require babel-core/register --recursive --exit test-coverage: ## launch tests with coverage @echo " > Testing with coverage" @$(MAKE) -s build - @export PORT=0 && export NODE_ENV=test && $(BABEL_NODE) $(BABEL_ISTANBUL) cover $(MOCHA_) --report html --report text --check-coverage -- --recursive + @export PORT=0 && \ + export NODE_ENV=test && \ + $(BABEL_NODE) $(BABEL_ISTANBUL) cover $(MOCHA_) --report html --report text --check-coverage -- --recursive --exit + +test-coverwall: ## launch + @export COVERALLS_SERVICE_NAME=service_name && \ + export COVERALLS_REPO_TOKEN=repo_token && \ + export PORT=0 && \ + export NODE_ENV=test && \ + $(BABEL_NODE) $(BABEL_ISTANBUL) cover $(MOCHA_) --report lcovonly --check-coverage -- --recursive --exit && \ + cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && \ + rm -rf ./coverage From 31a6b57a60fb8c9c1737db890e1c90fc8ed000a6 Mon Sep 17 00:00:00 2001 From: alexvndre Date: Tue, 14 Nov 2017 14:37:57 +0100 Subject: [PATCH 12/19] Add coverwalls badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index bc49b71..e78a8d8 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Build Status](https://travis-ci.org/alexvndre/expressjs-starter-pack.svg?branch=master)](https://travis-ci.org/alexvndre/expressjs-starter-pack) [![bitHound Overall Score](https://www.bithound.io/github/alexvndre/expressjs-starter-pack/badges/score.svg)](https://www.bithound.io/github/alexvndre/expressjs-starter-pack) +[![Coverage Status](https://coveralls.io/repos/github/alexvndre/expressjs-starter-pack/badge.svg?branch=feature%2Fci)](https://coveralls.io/github/alexvndre/expressjs-starter-pack?branch=feature%2Fci) A ready to use [Express.js](https://expressjs.com) solution. From ab80586c1084c11aead8e19d84900515fe847813 Mon Sep 17 00:00:00 2001 From: alexvndre Date: Tue, 14 Nov 2017 14:39:39 +0100 Subject: [PATCH 13/19] Update typo readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e78a8d8..8bfeb9f 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Run tests to verify the installation. ### Run the project (without [Docker](https://www.docker.com/)) -The project is available on [http://127.0.0.1:](http://127.0.0.1:). +The project is available on `http://127.0.0.1:`. `$ make start` From f2435cc6a75718967805396d2d9d27c75b3f547b Mon Sep 17 00:00:00 2001 From: alexvndre Date: Tue, 14 Nov 2017 14:52:24 +0100 Subject: [PATCH 14/19] Update changelog --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87c50d4..4f5bb22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [0.0.8] - 2017-11-14 +### Added +- Add CI +- Add [Travis](https://travis-ci.org/alexvndre/expressjs-starter-pack) +- Add [Coveralls](https://coveralls.io/github/alexvndre/expressjs-starter-pack) +- Add [Bithound](https://www.bithound.io/github/alexvndre/expressjs-starter-pack/master) +### Changed +- Update linter es2015 to env +- Lint tests ok + ## [0.0.7] - 2017-11-13 ### Added - Add Docker From e4e540d4c3925635ca1f7cb1be9438bfdd5aad31 Mon Sep 17 00:00:00 2001 From: alexvndre Date: Tue, 14 Nov 2017 15:10:34 +0100 Subject: [PATCH 15/19] Update travis and makefile --- .travis.yml | 2 +- Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4895f17..6af7ba2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,4 +8,4 @@ before_script: - cp ./.env.dist ./.env script: - ./node_modules/.bin/bithound check git@github.com:alexvndre/expressjs-starter-pack.git - - make test + - make test-coveralls diff --git a/Makefile b/Makefile index 6d19959..372f346 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ test-coverage: ## launch tests with coverage export NODE_ENV=test && \ $(BABEL_NODE) $(BABEL_ISTANBUL) cover $(MOCHA_) --report html --report text --check-coverage -- --recursive --exit -test-coverwall: ## launch +test-coveralls: ## launch tests with coverage and send to coveralls @export COVERALLS_SERVICE_NAME=service_name && \ export COVERALLS_REPO_TOKEN=repo_token && \ export PORT=0 && \ From b44fb7fb2fdacec2f5b4cd385d18c0a36e38e279 Mon Sep 17 00:00:00 2001 From: alexvndre Date: Tue, 14 Nov 2017 15:13:16 +0100 Subject: [PATCH 16/19] update make test-coveralls --- Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 372f346..89165ad 100644 --- a/Makefile +++ b/Makefile @@ -52,9 +52,7 @@ test-coverage: ## launch tests with coverage $(BABEL_NODE) $(BABEL_ISTANBUL) cover $(MOCHA_) --report html --report text --check-coverage -- --recursive --exit test-coveralls: ## launch tests with coverage and send to coveralls - @export COVERALLS_SERVICE_NAME=service_name && \ - export COVERALLS_REPO_TOKEN=repo_token && \ - export PORT=0 && \ + @export PORT=0 && \ export NODE_ENV=test && \ $(BABEL_NODE) $(BABEL_ISTANBUL) cover $(MOCHA_) --report lcovonly --check-coverage -- --recursive --exit && \ cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && \ From 08a060c95bfc2cd12ee4343a5f9d8f789cdd00d2 Mon Sep 17 00:00:00 2001 From: alexvndre Date: Tue, 14 Nov 2017 15:18:04 +0100 Subject: [PATCH 17/19] Update travis for coveralls --- .travis.yml | 4 +++- Makefile | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6af7ba2..28c9c0a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,4 +8,6 @@ before_script: - cp ./.env.dist ./.env script: - ./node_modules/.bin/bithound check git@github.com:alexvndre/expressjs-starter-pack.git - - make test-coveralls + - make test-coverage +after_script: + - cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js diff --git a/Makefile b/Makefile index 89165ad..2d03d07 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,7 @@ test-coverage: ## launch tests with coverage @$(MAKE) -s build @export PORT=0 && \ export NODE_ENV=test && \ - $(BABEL_NODE) $(BABEL_ISTANBUL) cover $(MOCHA_) --report html --report text --check-coverage -- --recursive --exit + $(BABEL_NODE) $(BABEL_ISTANBUL) cover $(MOCHA_) --report html --report lcovonly --report text --check-coverage -- --recursive --exit test-coveralls: ## launch tests with coverage and send to coveralls @export PORT=0 && \ From cbd3df074b8bb5fe9c40f99b310a9f5075f1da59 Mon Sep 17 00:00:00 2001 From: alexvndre Date: Tue, 14 Nov 2017 15:46:45 +0100 Subject: [PATCH 18/19] Update coveralls and makefile --- .travis.yml | 5 +++-- Makefile | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 28c9c0a..f73b7ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ before_script: - cp ./.env.dist ./.env script: - ./node_modules/.bin/bithound check git@github.com:alexvndre/expressjs-starter-pack.git - - make test-coverage + - make test after_script: - - cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js + - make test-coveralls +# - cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js diff --git a/Makefile b/Makefile index 2d03d07..f114712 100644 --- a/Makefile +++ b/Makefile @@ -54,6 +54,7 @@ test-coverage: ## launch tests with coverage test-coveralls: ## launch tests with coverage and send to coveralls @export PORT=0 && \ export NODE_ENV=test && \ + export COVERALLS_SERVICE_NAME=travis-ci && \ $(BABEL_NODE) $(BABEL_ISTANBUL) cover $(MOCHA_) --report lcovonly --check-coverage -- --recursive --exit && \ cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && \ rm -rf ./coverage From 6b694e59d9435b16bc91016242a9fd6b2ea5632d Mon Sep 17 00:00:00 2001 From: alexvndre Date: Tue, 14 Nov 2017 16:04:28 +0100 Subject: [PATCH 19/19] Coverage --- .travis.yml | 1 - Makefile | 2 +- src/helper/logger.js | 6 +++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index f73b7ad..823dddd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,4 +11,3 @@ script: - make test after_script: - make test-coveralls -# - cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js diff --git a/Makefile b/Makefile index f114712..8ee952a 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,7 @@ test-coverage: ## launch tests with coverage @$(MAKE) -s build @export PORT=0 && \ export NODE_ENV=test && \ - $(BABEL_NODE) $(BABEL_ISTANBUL) cover $(MOCHA_) --report html --report lcovonly --report text --check-coverage -- --recursive --exit + $(BABEL_NODE) $(BABEL_ISTANBUL) cover $(MOCHA_) --report html --report text --check-coverage -- --recursive --exit test-coveralls: ## launch tests with coverage and send to coveralls @export PORT=0 && \ diff --git a/src/helper/logger.js b/src/helper/logger.js index f863eb2..22cb473 100644 --- a/src/helper/logger.js +++ b/src/helper/logger.js @@ -11,7 +11,7 @@ class Logger { ], }); - if (process.env.NODE_ENV === 'local') { + if (process.env.NODE_ENV === 'local' || process.env.NODE_ENV === 'test') { this._logger.add(winston.transports.Console, { level: 'info', timestamp: () => (new Date().toISOString()), @@ -21,13 +21,13 @@ class Logger { } info(message, meta) { - if (process.env.NODE_ENV === 'local') { + if (process.env.NODE_ENV === 'local' || process.env.NODE_ENV === 'test') { this._logger.log('info', message, meta); } } error(message, meta) { - if (process.env.NODE_ENV === 'local') { + if (process.env.NODE_ENV === 'local' || process.env.NODE_ENV === 'test') { this._logger.log('error', message, meta); } }