From 10d108878aed2eba3060891b61d8ec134cdd7415 Mon Sep 17 00:00:00 2001 From: Joey Baker Date: Wed, 26 Oct 2016 17:24:59 -0700 Subject: [PATCH 1/2] Chore(deps) install codecov and nyc --- package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/package.json b/package.json index a54aa74..63835c2 100644 --- a/package.json +++ b/package.json @@ -33,12 +33,14 @@ "babel-preset-stage-1": "^6.16.0", "babel-register": "^6.16.3", "bluebird": "^3.4.6", + "codecov": "^1.0.1", "eslint": "^3.8.1", "eslint-config-pichak": "^1.1.2", "eslint-plugin-ava": "^3.1.1", "ghooks": "^1.3.2", "hapi": "^15.2.0", "hapi-sequelize": "^3.0.4", + "nyc": "^8.3.2", "portfinder": "^1.0.9", "scripty": "^1.6.0", "sequelize": "^3.24.6", -- 2.34.1 From 57f95f8c951c8026a0ef390268f60b49e753c712 Mon Sep 17 00:00:00 2001 From: Joey Baker Date: Wed, 26 Oct 2016 17:25:18 -0700 Subject: [PATCH 2/2] Test(CI) setup code coverage Also moves ava config to package.json --- .gitignore | 3 +++ circle.yml | 6 +++++- package.json | 25 +++++++++++++++++++++---- scripts/test.sh | 14 ++++++++++++++ 4 files changed, 43 insertions(+), 5 deletions(-) create mode 100755 scripts/test.sh diff --git a/.gitignore b/.gitignore index e1c0e0e..4484695 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,6 @@ npm-debug.log # System .DS_Store + +coverage.lcov +.nyc_output diff --git a/circle.yml b/circle.yml index 7112679..e5a5a33 100644 --- a/circle.yml +++ b/circle.yml @@ -1,9 +1,13 @@ machine: node: - version: 6.5.0 + version: 6.9.0 dependencies: pre: - npm prune post: - mkdir -p $CIRCLE_TEST_REPORTS/ava + +test: + post: + - npm run coverage diff --git a/package.json b/package.json index 63835c2..293d4c0 100644 --- a/package.json +++ b/package.json @@ -10,10 +10,11 @@ }, "scripts": { "lint": "eslint src", - "test": "ava --require babel-register --source='src/**/*.js' --source='!build/**/*' --tap=${CI-false} src/**/*.test.js | $(if [ -z ${CI:-} ]; then echo 'tail'; else tap-xunit > $CIRCLE_TEST_REPORTS/ava/ava.xml; fi;)", - "tdd": "ava --require babel-register --source='src/**/*.js' --source='!build/**/*' --watch src/**/*.test.js", - "build": "scripty", - "watch": "scripty" + "test": "SCRIPTY_SILENT=true scripty", + "coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov", + "tdd": "ava --watch", + "build": "SCRIPTY_SILENT=true scripty", + "watch": "SCRIPTY_SILENT=true scripty" }, "repository": { "git": "https://github.com/mdibaiee/hapi-sequelize-crud" @@ -56,5 +57,21 @@ }, "optionalDependencies": { "babel-polyfill": "^6.13.0" + }, + "nyc": { + "cache": true + }, + "ava": { + "source": [ + "src/**/*.js", + "!build/**/*" + ], + "files": [ + "**/*.test.js", + "!build/**/*" + ], + "require": [ + "babel-register" + ] } } diff --git a/scripts/test.sh b/scripts/test.sh new file mode 100755 index 0000000..f86bdf7 --- /dev/null +++ b/scripts/test.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# strict mode http://redsymbol.net/articles/unofficial-bash-strict-mode/ +set -euo pipefail +IFS=$'\n\t' + +nyc=./node_modules/.bin/nyc +ava=./node_modules/.bin/ava + +if [ ! -z ${CI:-} ]; then + $nyc $ava --tap=${CI-false} | tap-xunit > $CIRCLE_TEST_REPORTS/ava/ava.xml +else + $nyc $ava +fi + -- 2.34.1