diff --git a/.travis.yml b/.travis.yml index 4c5d46d7711..8cf9d40c0ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,7 @@ notifications: env: - CXX=g++-4.8 NODE_ENV=test TEST_DIR=lint - CXX=g++-4.8 NODE_ENV=test TEST_DIR=unit + - CXX=g++-4.8 NODE_ENV=test TEST_DIR=codecov - CXX=g++-4.8 NODE_ENV=test TEST_DIR=about - CXX=g++-4.8 NODE_ENV=test TEST_DIR=app - CXX=g++-4.8 NODE_ENV=test TEST_DIR=bookmark-components diff --git a/README.md b/README.md index 0c7061977d4..3e084e93a4d 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ [![Misc Tests](https://badges.herokuapp.com/travis/brave/browser-laptop?env=TEST_DIR=misc-components&label=misc-components-tests)](https://travis-ci.org/brave/browser-laptop) [![Navbar Tests](https://badges.herokuapp.com/travis/brave/browser-laptop?env=TEST_DIR=navbar-components&label=navbar-components-tests)](https://travis-ci.org/brave/browser-laptop) [![Tab Tests](https://badges.herokuapp.com/travis/brave/browser-laptop?env=TEST_DIR=tab-components&label=tab-components-tests)](https://travis-ci.org/brave/browser-laptop) +[![codecov.io](https://codecov.io/github/brave/browser-laptop/coverage.svg?branch=master)](https://codecov.io/gh/brave/browser-laptop?branch=master) # Brave Browser diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000000..d6a9e2e474b --- /dev/null +++ b/codecov.yml @@ -0,0 +1,17 @@ +codecov: + notify: + require_ci_to_pass: no # require CI to pass + ci: + - !appveyor +flags: + unittest: + paths: + - app/ + - js/ +comment: + layout: "diff, flags, files" + behavior: default + require_changes: true + require_base: no + require_head: yes + branches: null diff --git a/package.json b/package.json index 808e582cb4f..657dab66e93 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "test": "cross-env NODE_ENV=test mocha \"test/**/*Test.js\"", "testsuite": "node ./tools/test.js", "unittest": "cross-env NODE_ENV=test mocha \"test/unit/**/*Test.js\"", - "unittest-cov": "node --harmony node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha --report html --report text -x \"test/unit/**/*Test.js\" -- \"test/unit/**/*Test.js\"", + "unittest-cov": "node --harmony node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha --report lcovonly --report html --report text -x \"test/unit/**/*Test.js\" -- \"test/unit/**/*Test.js\"", "update-pdfjs": "rm -r app/extensions/pdfjs/; cp -r ../pdf.js/build/chromium/ app/extensions/pdfjs/", "update-psl": "./tools/updatepsl.sh", "vagrant-destroy-linux": "VAGRANT_CWD=./test/vms/vagrant/ubuntu-14.04 vagrant destroy", diff --git a/tools/codecov.sh b/tools/codecov.sh new file mode 100644 index 00000000000..1181dd74c2a --- /dev/null +++ b/tools/codecov.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +npm install -g codecov +npm run unittest-cov +bash <(curl -s https://codecov.io/bash) -F unittest diff --git a/tools/test.js b/tools/test.js index dc0ff6298df..4c72cb826fa 100644 --- a/tools/test.js +++ b/tools/test.js @@ -2,16 +2,21 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -var execute = require('./lib/execute') +const execute = require('./lib/execute') const TEST_DIR = process.env.TEST_DIR -var cmd = [] +let cmd = [] -if (TEST_DIR === 'lint') { - cmd.push('standard') -} else { - cmd.push(`mocha "test/${TEST_DIR}/**/*Test.js"`) +switch (TEST_DIR) { + case 'lint': + cmd.push('standard') + break + case 'codecov': + cmd.push('bash tools/codecov.sh') + break + default: + cmd.push(`mocha "test/${TEST_DIR}/**/*Test.js"`) } execute(cmd, process.env, (err) => {