Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Add code coverage (#164)
Browse files Browse the repository at this point in the history
* Install `ember-cli-code-coverage` addon

* Configure the CI to run and report coverage

* Add coverage badge to README
  • Loading branch information
alexlafroscia authored Sep 30, 2016
1 parent b5b01f5 commit b32b9ee
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 11 deletions.
22 changes: 18 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
---
sudo: required
dist: trusty

addons:
apt:
sources:
- google-chrome
packages:
- google-chrome-stable

language: node_js
node_js:
- "4"

sudo: false

cache:
directories:
- node_modules

env:
- EMBER_TRY_SCENARIO=default
- EMBER_TRY_SCENARIO=default COVERAGE=true # Only log coverage from the default scenario
- EMBER_TRY_SCENARIO=ember-release
- EMBER_TRY_SCENARIO=ember-beta
- EMBER_TRY_SCENARIO=ember-canary
Expand All @@ -21,13 +29,19 @@ matrix:
- env: EMBER_TRY_SCENARIO=ember-canary

before_install:
# Setup for Chrome
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
# Other setup
- npm config set spin false
- npm install -g bower
- npm install phantomjs-prebuilt

install:
- npm install
- bower install

script:
- ember try $EMBER_TRY_SCENARIO test --skip-cleanup

after_success:
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Travis CI Build Status](https://travis-ci.org/ember-cli/ember-ajax.svg?branch=master)](https://travis-ci.org/ember-cli/ember-ajax)
[![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/rjfngst9s19p3cp8/branch/master?svg=true)](https://ci.appveyor.com/project/alexlafroscia/ember-ajax/branch/master)
[![Coverage Status](https://coveralls.io/repos/github/ember-cli/ember-ajax/badge.svg?branch=master)](https://coveralls.io/github/ember-cli/ember-ajax?branch=master)
[![Ember Observer Score](http://emberobserver.com/badges/ember-ajax.svg)](http://emberobserver.com/addons/ember-ajax)
![Ember Version][ember-version]

Expand Down Expand Up @@ -292,7 +293,7 @@ export default function someUtility(url) {
var options = {
// request options
};

return request(url, options).then(response => {
// `response` is the data from the server
return response;
Expand All @@ -310,7 +311,7 @@ export default function someOtherUtility(url) {
var options = {
// raw options
};

return raw(url, options).then(result => {
// `result` is an object containing `response` and `jqXHR`, among other items
return result;
Expand Down
1 change: 0 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"ember": "~2.6.0",
"ember-cli-shims": "0.1.0",
"ember-qunit-notifications": "0.1.0",
"pretender": "^0.10.1",
"mocha": "~2.2.4",
"chai": "~2.3.0",
"ember-mocha-adapter": "~0.3.1"
Expand Down
7 changes: 7 additions & 0 deletions config/coverage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

module.exports = {
excludes: [
'tests/dummy/**/*'
]
};
2 changes: 0 additions & 2 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,5 @@ module.exports = function(defaults) {
behave. You most likely want to be modifying `./index.js` or app's build file
*/

app.import(app.bowerDirectory + '/pretender/pretender.js');

return app.toTree();
};
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
"devDependencies": {
"babel-eslint": "^6.1.2",
"broccoli-asset-rev": "^2.4.3",
"coveralls": "^2.11.13",
"ember-cli": "2.8.0",
"ember-cli-app-version": "^2.0.0",
"ember-cli-code-coverage": "0.3.1",
"ember-cli-content-security-policy": "0.5.0",
"ember-cli-dependency-checker": "^1.3.0",
"ember-cli-eslint": "3.0.0",
Expand Down
3 changes: 1 addition & 2 deletions testem.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ module.exports = {
test_page: 'tests/index.html?hidepassed',
disable_watching: true,
launch_in_ci: [
'PhantomJS'
'Chrome'
],
launch_in_dev: [
'PhantomJS',
'Chrome'
]
};

0 comments on commit b32b9ee

Please sign in to comment.