From 1ec41e5d872b47d21fd172fb73192eced44c6c16 Mon Sep 17 00:00:00 2001 From: Austin Burdine Date: Mon, 9 Jan 2017 17:00:12 -0600 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20code=20coverage=20(#481)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit no issue - adds code coverage via ember-cli-code-coverage - add coverage and ember-cli-code-coverage deps --- ghost/admin/.travis.yml | 5 ++++- ghost/admin/app/mirage/config.js | 1 + ghost/admin/package.json | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ghost/admin/.travis.yml b/ghost/admin/.travis.yml index 2c10e70349..c7ffe462af 100644 --- a/ghost/admin/.travis.yml +++ b/ghost/admin/.travis.yml @@ -38,4 +38,7 @@ before_script: - export DISPLAY=:99; sh -e /etc/init.d/xvfb start; sleep 3; script: - - if [ "$TEST_SUITE" == "lint" ]; then npm run lint; else npm test; fi + - COVERAGE=true npm test + +after_success: + - npm run coverage diff --git a/ghost/admin/app/mirage/config.js b/ghost/admin/app/mirage/config.js index e44ae4310d..f6aad60d17 100644 --- a/ghost/admin/app/mirage/config.js +++ b/ghost/admin/app/mirage/config.js @@ -32,6 +32,7 @@ export default function () { // Mock all endpoints here as there is no real API during testing export function testConfig() { + this.passthrough('/write-coverage'); // For code coverage // this.urlPrefix = ''; // make this `http://localhost:8080`, for example, if your API is on a different server this.namespace = '/ghost/api/v0.1'; // make this `api`, for example, if your API is namespaced // this.timing = 400; // delay for each request, automatically set to 0 during testing diff --git a/ghost/admin/package.json b/ghost/admin/package.json index ff00070440..5cf4970465 100644 --- a/ghost/admin/package.json +++ b/ghost/admin/package.json @@ -19,7 +19,8 @@ "start": "ember server", "build": "ember build", "test": "ember test", - "lint": "ember test --launch phantomjs -f 'ESLint'" + "lint": "ember test --launch phantomjs -f 'ESLint'", + "coverage": "cat ./coverage/lcov.info | coveralls" }, "engines": { "node": "~0.12.0 || ^4.2.0" @@ -33,12 +34,14 @@ "broccoli-merge-trees": "1.2.1", "broccoli-uglify-js": "0.2.0", "codemirror": "5.22.0", + "coveralls": "2.11.15", "csscomb": "3.1.8", "ember-ajax": "2.5.3", "ember-cli": "2.10.0", "ember-cli-app-version": "2.0.1", "ember-cli-babel": "5.2.1", "ember-cli-chai": "0.3.0", + "ember-cli-code-coverage": "0.3.8", "ember-cli-content-security-policy": "0.5.0", "ember-cli-dependency-checker": "1.3.0", "ember-cli-deprecation-workflow": "0.2.3",