diff --git a/.travis.yml b/.travis.yml index b6344fa8..c63bfd95 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,4 +12,9 @@ before_install: - docker-compose -f test.yml -p test build script: -- docker-compose -f test.yml -p test run --rm --entrypoint 'npm test' web +- docker-compose -f test.yml -p test run --rm + --entrypoint 'npm test' + -e TRAVIS_JOB_ID=$TRAVIS_JOB_ID + -e TRAVIS_BRANCH=$TRAVIS_BRANCH + -e TRAVIS=$TRAVIS + web diff --git a/README.md b/README.md index b95547c9..fb2bb796 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Web Build Status](https://travis-ci.org/open-eats/openeats-web.svg?branch=master)](https://travis-ci.org/open-eats/openeats-web) [![Coverage Status](https://coveralls.io/repos/github/open-eats/openeats-web/badge.svg)](https://coveralls.io/github/open-eats/openeats-web) +[![Maintainability](https://api.codeclimate.com/v1/badges/5e46696ad10370f28ba3/maintainability)](https://codeclimate.com/github/open-eats/openeats-web/maintainability) This is the official web app that powers OpenEats. It's built using React/Redux. @@ -18,7 +19,8 @@ To run tests locally: ```bash cd openeats-api docker-compose -f test.yml -p test build -docker-compose -f test.yml -p test run --rm --entrypoint 'npm test' web +docker-compose -f test.yml -p test run --rm --entrypoint sh web +./node_modules/.bin/jest --coverage ``` #### Generating locale files diff --git a/package.json b/package.json index 8c3e5b4c..1a0e4f08 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "start:prod": "webpack && node server.js", "start:demo": "webpack", "build": "webpack", - "test": "jest" + "test": "./tests.sh" }, "jest": { "moduleNameMapper": { diff --git a/tests.sh b/tests.sh new file mode 100755 index 00000000..58481ec1 --- /dev/null +++ b/tests.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env sh + +# Install test related dependencies +yarn add coveralls + +# Run the tests and create a coverage report +jest --coverage + +# Submit coverage to Coveralls +coveralls < coverage/lcov.info \ No newline at end of file