Test(CI) setup code coverage
Also moves ava config to package.json
This commit is contained in:
		
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -36,3 +36,6 @@ npm-debug.log
 | 
			
		||||
 | 
			
		||||
# System
 | 
			
		||||
.DS_Store
 | 
			
		||||
 | 
			
		||||
coverage.lcov
 | 
			
		||||
.nyc_output
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										25
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								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"
 | 
			
		||||
    ]
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								scripts/test.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										14
									
								
								scripts/test.sh
									
									
									
									
									
										Executable 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
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user