From 8260e4038565c5c0cb38c1aa4327e8fcfc698661 Mon Sep 17 00:00:00 2001 From: Jesse Zoldak Date: Sun, 23 Oct 2016 18:08:13 -0400 Subject: [PATCH 1/2] Measure test coverage --- .gitignore | 4 ++++ Makefile | 21 +++++++++------------ package.json | 10 +++++++++- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 87f017249..0eed05504 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,7 @@ npm-* !.elasticbeanstalk/*.global.yml deploy.zip ENV + +# Test +/.nyc_output +/coverage diff --git a/Makefile b/Makefile index e94100fb3..aba604e54 100644 --- a/Makefile +++ b/Makefile @@ -52,13 +52,7 @@ start: test: @make lint @make build - @echo "" - @make unit - @echo "" - @make functional - @echo "" - @make localization - @echo "" + @make coverage lint: $(ESLINT) . --ext .js,.jsx,.json @@ -66,17 +60,20 @@ lint: $(SASSLINT) ./src/**/*.scss unit: - $(TAP) ./test/unit/*.js + $(TAP) --coverage ./test/unit/*.js functional: - $(TAP) ./test/functional/*.js + $(TAP) --coverage ./test/functional/*.js integration: - $(TAP) ./test/integration/*.js + $(TAP) --coverage ./test/integration/*.js localization: - $(TAP) ./test/localization/*.js + $(TAP) --coverage ./test/localization/*.js + +coverage: + $(TAP) --coverage ./test/{unit,functional,localization}/*.js # ------------------------------------ -.PHONY: build clean deploy translations webpack stop start test lint unit functional integration localization +.PHONY: build clean deploy translations webpack stop start test lint unit functional integration localization coverage diff --git a/package.json b/package.json index 18d507095..0fce98c35 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,7 @@ "lodash.range": "3.0.1", "minilog": "2.0.8", "node-sass": "3.3.3", + "nyc": "8.3.2", "pako": "0.2.8", "po2icu": "0.0.2", "postcss-loader": "0.8.2", @@ -87,11 +88,18 @@ "slick-carousel": "1.5.8", "source-map-support": "0.3.2", "style-loader": "0.12.3", - "tap": "2.0.0", + "tap": "7.1.2", "url-loader": "0.5.6", "watch": "0.16.0", "webpack": "1.12.14", "webpack-dev-middleware": "1.2.0", "xhr": "2.2.0" + }, + "nyc": { + "include": [ + "bin/**/*.js", + "src/**/*.js" + ], + "all": true } } From 838925cca0c16014fbdd8ea7f308725a5fda5425 Mon Sep 17 00:00:00 2001 From: Jesse Zoldak Date: Fri, 28 Oct 2016 17:56:41 -0400 Subject: [PATCH 2/2] Output coverage data only when make coverage is executed --- Makefile | 18 ++++++++++-------- package.json | 1 - 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index aba604e54..82f7613df 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,6 @@ clean: mkdir -p build mkdir -p intl - deploy: @make build @make sync @@ -52,7 +51,7 @@ start: test: @make lint @make build - @make coverage + @make tap lint: $(ESLINT) . --ext .js,.jsx,.json @@ -60,20 +59,23 @@ lint: $(SASSLINT) ./src/**/*.scss unit: - $(TAP) --coverage ./test/unit/*.js + $(TAP) ./test/unit/*.js functional: - $(TAP) --coverage ./test/functional/*.js + $(TAP) ./test/functional/*.js integration: - $(TAP) --coverage ./test/integration/*.js + $(TAP) ./test/integration/*.js localization: - $(TAP) --coverage ./test/localization/*.js + $(TAP) ./test/localization/*.js + +tap: + $(TAP) ./test/{unit,functional,localization}/*.js coverage: - $(TAP) --coverage ./test/{unit,functional,localization}/*.js + $(TAP) ./test/{unit,functional,localization}/*.js --coverage --coverage-report=lcov # ------------------------------------ -.PHONY: build clean deploy translations webpack stop start test lint unit functional integration localization coverage +.PHONY: build clean deploy translations webpack start test lint unit functional integration localization tap coverage diff --git a/package.json b/package.json index 0fce98c35..e4a06db2a 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,6 @@ "lodash.range": "3.0.1", "minilog": "2.0.8", "node-sass": "3.3.3", - "nyc": "8.3.2", "pako": "0.2.8", "po2icu": "0.0.2", "postcss-loader": "0.8.2",