Skip to content
This repository has been archived by the owner on Feb 8, 2019. It is now read-only.

Commit

Permalink
⭐ new: support covrage service selecting
Browse files Browse the repository at this point in the history
  • Loading branch information
kazupon committed Dec 28, 2016
1 parent f692bd3 commit c52059d
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 11 deletions.
16 changes: 13 additions & 3 deletions meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,19 @@ module.exports = {
type: 'confirm',
message: 'Setup e2e tests?'
},
coveralls: {
coverage: {
type: 'confirm',
message: 'Setup coveralls?'
message: 'Setup coverage services?'
},
coverageConfig: {
when: 'coverage',
type: 'list',
message: 'Choice a coverage service',
choices: [
'coveralls',
'codecov'
],
default: ['codecov']
},
sauce: {
type: 'confirm',
Expand Down Expand Up @@ -102,7 +112,7 @@ module.exports = {
"test/e2e/**/*": 'e2e',
".travis.yml": "ciConfig === 'travis'",
"circl.yml": "ciConfig === 'circlci'",
"config/karma.coveralls.conf.js": 'coveralls',
"config/karma.coveralls.conf.js": "coverageConfig === 'coveralls'",
".flowconfig": 'flow',
"decls/*": 'flow',
"gitbook/**/**": 'gitbook',
Expand Down
2 changes: 2 additions & 0 deletions template/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# {{ name }}

{{#if_eq coverageConfig "coveralls"}}[![Coverage Status](https://coveralls.io/repos/github/{{ githubAccount }}/{{ name }}/badge.svg?branch={{ branch }})](https://coveralls.io/github/{{ githubAccount }}/{{ name }}?branch={{ branch }}){{/if_eq}}
{{#if_eq coverageConfig "codecov"}}[![codecov](https://codecov.io/gh/{{ githubAccount }}/{{ name }}/branch/{{ branch }}/graph/badge.svg)](https://codecov.io/gh/{{ githubAccount }}/{{ branch }}){{/if_eq}}
[![npm](https://img.shields.io/npm/v/{{ name }}.svg)](https://www.npmjs.com/package/{{ name }})
[![vue2](https://img.shields.io/badge/vue-2.x-brightgreen.svg)](https://vuejs.org/)

Expand Down
5 changes: 5 additions & 0 deletions template/circle.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
machine:
node:
version: 6
{{#if_eq coverageConfig "codecov"}}
test:
post:
- npm run coverage && bash <(curl -s https://codecov.io/bash)
{{/if_eq}}
7 changes: 3 additions & 4 deletions template/config/karma.cover.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ module.exports = config => {
browsers: ['PhantomJS'],
reporters: ['mocha', 'coverage'],
coverageReporter: {
reporters: [{
type: 'lcov', dir: '../coverage'
}, {
type: 'text-summary', dir: '../coverage'
reporters: [
{ type: 'lcov', dir: '../coverage', subdir: '.' },
{ type: 'text-summary', dir: '../coverage', subdir: '.' }
}]
},
singleRun: true
Expand Down
11 changes: 7 additions & 4 deletions template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
"karma": "^1.1.0",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.0.0",
{{#coveralls}}
{{#if_eq coverageConfig "coveralls"}}
"karma-coveralls": "^1.1.2",
{{/coveralls}}
{{/if_eq}}
"karma-firefox-launcher": "^1.0.0",
"karma-jasmine": "^1.0.2",
"karma-mocha-reporter": "^2.0.4",
Expand Down Expand Up @@ -109,6 +109,9 @@
"release": "conventional-github-releaser {{#unless_eq conventionalConfig "none"}}-p {{ conventionalConfig }}{{/unless_eq}}{{#if_eq conventionalConfig "none"}}-n ./config/convention.js{{/if_eq}}",
{{/conventional}}
"clean": "rm -rf coverage && rm -rf dist/*.js* && rm ./*.log",
{{#if_eq coverageConfig "codecov"}}
"coverage": "cat ./coverage/lcov.info",
{{/if_eq}}
"dev": "webpack-dev-server --quiet --config config/webpack.dev.conf.js --host 0.0.0.0",
{{#gitbook}}
"docs": "gitbook serve ./gitbook ./docs",
Expand All @@ -127,9 +130,9 @@
{{/sauce}}
"test": "npm run lint && {{#flow}}npm run flow && {{/flow}}npm run test:cover{{#e2e}} && npm run test:e2e -- --env phantomjs{{/e2e}}",
"test:cover": "karma start config/karma.cover.conf.js",
{{#coveralls}}
{{#if_eq coverageConfig "coveralls"}}
"test:coveralls": "karma start config/karma.coveralls.conf.js",
{{/coveralls}}
{{/if_eq}}
{{#e2e}}
"test:e2e": "npm run build && node test/e2e/runner.js",
{{/e2e}}
Expand Down

0 comments on commit c52059d

Please sign in to comment.