Skip to content

Commit

Permalink
CodeCov support
Browse files Browse the repository at this point in the history
  • Loading branch information
NejcZdovc committed Jul 20, 2017
1 parent dc76f0a commit 0ce9e43
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 7 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
17 changes: 17 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions tools/codecov.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

npm install -g codecov
npm run unittest-cov
bash <(curl -s https://codecov.io/bash) -F unittest
17 changes: 11 additions & 6 deletions tools/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 0ce9e43

Please sign in to comment.