Add code coverage #29

Merged
joeybaker merged 2 commits from code-coverage into master 2016-10-27 01:14:37 +00:00
4 changed files with 45 additions and 5 deletions

3
.gitignore vendored
View File

@ -36,3 +36,6 @@ npm-debug.log
# System # System
.DS_Store .DS_Store
coverage.lcov
.nyc_output

View File

@ -1,9 +1,13 @@
machine: machine:
node: node:
version: 6.5.0 version: 6.9.0
dependencies: dependencies:
pre: pre:
- npm prune - npm prune
post: post:
- mkdir -p $CIRCLE_TEST_REPORTS/ava - mkdir -p $CIRCLE_TEST_REPORTS/ava
test:
post:
- npm run coverage

View File

@ -10,10 +10,11 @@
}, },
"scripts": { "scripts": {
"lint": "eslint src", "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;)", "test": "SCRIPTY_SILENT=true scripty",
"tdd": "ava --require babel-register --source='src/**/*.js' --source='!build/**/*' --watch src/**/*.test.js", "coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
"build": "scripty", "tdd": "ava --watch",
"watch": "scripty" "build": "SCRIPTY_SILENT=true scripty",
"watch": "SCRIPTY_SILENT=true scripty"
}, },
"repository": { "repository": {
"git": "https://github.com/mdibaiee/hapi-sequelize-crud" "git": "https://github.com/mdibaiee/hapi-sequelize-crud"
@ -33,12 +34,14 @@
"babel-preset-stage-1": "^6.16.0", "babel-preset-stage-1": "^6.16.0",
"babel-register": "^6.16.3", "babel-register": "^6.16.3",
"bluebird": "^3.4.6", "bluebird": "^3.4.6",
"codecov": "^1.0.1",
"eslint": "^3.8.1", "eslint": "^3.8.1",
"eslint-config-pichak": "^1.1.2", "eslint-config-pichak": "^1.1.2",
"eslint-plugin-ava": "^3.1.1", "eslint-plugin-ava": "^3.1.1",
"ghooks": "^1.3.2", "ghooks": "^1.3.2",
"hapi": "^15.2.0", "hapi": "^15.2.0",
"hapi-sequelize": "^3.0.4", "hapi-sequelize": "^3.0.4",
"nyc": "^8.3.2",
"portfinder": "^1.0.9", "portfinder": "^1.0.9",
"scripty": "^1.6.0", "scripty": "^1.6.0",
"sequelize": "^3.24.6", "sequelize": "^3.24.6",
@ -54,5 +57,21 @@
}, },
"optionalDependencies": { "optionalDependencies": {
"babel-polyfill": "^6.13.0" "babel-polyfill": "^6.13.0"
},
"nyc": {
"cache": true
},
"ava": {
"source": [
"src/**/*.js",
"!build/**/*"
],
"files": [
"**/*.test.js",
"!build/**/*"
],
"require": [
"babel-register"
]
} }
} }

14
scripts/test.sh Executable file
View File

@ -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