Set up istanbul with codeclimate and travis. (#1046)

* Set up istanbul with codeclimate and travis.

* Put the codeclimate tocken inside .travis.yml
This commit is contained in:
Bogdan 2016-08-31 09:27:07 -07:00 committed by GitHub
parent 3f889492f9
commit 85d03f5e18
6 changed files with 70 additions and 6 deletions

View File

@ -1,18 +1,20 @@
language: python
addons:
code_climate:
repo_token: 5f3a06c425eef7be4b43627d7d07a3e46c45bdc07155217825ff7c49cb6a470c
apt:
sources:
- deadsnakes
packages:
- python3.5
code_climate:
repo_token: 5f3a06c425eef7be4b43627d7d07a3e46c45bdc07155217825ff7c49cb6a470c
cache:
directories:
- $HOME/.wheelhouse/
env:
global:
- TRAVIS_CACHE=$HOME/.travis_cache/
- TRAVIS_NODE_VERSION="5.11"
matrix:
#- TOX_ENV=py27-mysql
- TOX_ENV=py27-sqlite
@ -22,7 +24,7 @@ env:
- TOX_ENV=py34-postgres
- TOX_ENV=javascript
before_install:
- npm install -g npm@'>=2.7.1'
- npm install -g npm@'>=3.9.5'
before_script:
- mysql -e 'drop database if exists caravel; create database caravel DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci' -u root
- psql -c 'create database caravel;' -U postgres
@ -30,4 +32,6 @@ before_script:
install:
- pip install --upgrade pip
- pip install tox tox-travis
- rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION
- npm install
script: tox -e $TOX_ENV

View File

@ -3,3 +3,4 @@ vendor/*
dist/*
stylesheets/*
spec/*
coverage/**

View File

@ -0,0 +1,54 @@
verbose: true
instrumentation:
root: './javascripts'
extensions: ['.js', '.jsx']
excludes: [
'dist/**'
]
embed-source: false
variable: __coverage__
compact: true
preserve-comments: false
complete-copy: false
save-baseline: true
baseline-file: ./coverage/coverage-baseline.json
include-all-sources: true
include-pid: false
es-modules: true
reporting:
print: summary
reports:
- lcov
dir: ./coverage
watermarks:
statements: [50, 80]
lines: [50, 80]
functions: [50, 80]
branches: [50, 80]
report-config:
clover: {file: clover.xml}
cobertura: {file: cobertura-coverage.xml}
json: {file: coverage-final.json}
json-summary: {file: coverage-summary.json}
lcovonly: {file: lcov.info}
teamcity: {file: null, blockName: Code Coverage Summary}
text: {file: null, maxCols: 0}
text-lcov: {file: lcov.info}
text-summary: {file: null}
hooks:
hook-run-in-context: false
post-require-hook: null
handle-sigint: false
check:
global:
statements: 0
lines: 0
branches: 0
functions: 0
excludes: []
each:
statements: 0
lines: 0
branches: 0
functions: 0
excludes: []

View File

@ -2,7 +2,10 @@
set -e
cd "$(dirname "$0")"
npm --version
node --version
npm install
npm run lint
npm run test
npm run prod
npm run cover
CODECLIMATE_REPO_TOKEN=5f3a06c425eef7be4b43627d7d07a3e46c45bdc07155217825ff7c49cb6a470c ./node_modules/.bin/codeclimate-test-reporter < ./coverage/lcov.info

View File

@ -7,7 +7,8 @@
"test": "spec"
},
"scripts": {
"test": "npm run lint && mocha --compilers js:babel-core/register --required spec/helpers/browser.js spec/**/*_spec.*",
"test": "npm run lint && mocha --compilers js:babel-core/register --require spec/helpers/browser.js --recursive spec/**/*_spec.*",
"cover": "babel-node ./node_modules/.bin/istanbul cover _mocha -- --require spec/helpers/browser.js --recursive spec/**/*_spec.*",
"dev": "NODE_ENV=dev webpack -d --watch --colors --progress",
"prod": "NODE_ENV=production webpack -p --colors --progress",
"lint": "npm run --silent lint:js",
@ -36,6 +37,7 @@
"homepage": "https://github.com/airbnb/caravel#readme",
"dependencies": {
"autobind-decorator": "^1.3.3",
"babel-cli": "^6.14.0",
"bootstrap": "^3.3.6",
"bootstrap-datepicker": "^1.6.0",
"brace": "^0.7.0",
@ -90,6 +92,7 @@
"babel-preset-es2015": "^6.9.0",
"babel-preset-react": "^6.11.1",
"chai": "^3.5.0",
"codeclimate-test-reporter": "^0.3.3",
"css-loader": "^0.23.1",
"enzyme": "^2.0.0",
"eslint": "^2.13.1",
@ -98,6 +101,7 @@
"eslint-plugin-jsx-a11y": "^2.0.1",
"eslint-plugin-react": "^5.2.2",
"exports-loader": "^0.6.3",
"istanbul": "^1.0.0-alpha",
"file-loader": "^0.8.5",
"imports-loader": "^0.6.5",
"jsdom": "^8.0.1",

View File

@ -18,5 +18,3 @@ Object.keys(document.defaultView).forEach((property) => {
global.navigator = {
userAgent: 'node.js',
};
documentRef = document;