diff --git a/meta.js b/meta.js index b6b89c9..a93d1fb 100644 --- a/meta.js +++ b/meta.js @@ -35,6 +35,10 @@ module.exports = { type: 'confirm', message: 'Setup e2e tests?' }, + coveralls: { + type: 'confirm', + message: 'Setup coveralls?' + }, sauce: { type: 'confirm', message: 'Setup sauce tests?' @@ -75,9 +79,10 @@ module.exports = { filters: { "examples/**/*": 'e2e', "test/e2e/**/*": 'e2e', + "test/e2e/**/*": 'e2e', + "config/karma.coveralls.conf.js": 'coveralls', ".flowconfig": 'flow', "decls/*": 'flow', - "test/e2e/**/*": 'e2e', "docs/**/**": 'gitbook', "issue_template.md": 'issue' }, diff --git a/template/config/karma.coveralls.conf.js b/template/config/karma.coveralls.conf.js new file mode 100644 index 0000000..737b424 --- /dev/null +++ b/template/config/karma.coveralls.conf.js @@ -0,0 +1,21 @@ +const base = require('./karma.base.conf') + +module.exports = config => { + const options = Object.assign(base, { + browsers: ['PhantomJS'], + reporters: ['coverage', 'coveralls'], + coverageReporter: { + reporters: [{ + type: 'lcov', dir: '../coverage' + }] + }, + singleRun: true + }) + + // add babel-plugin-coverage for code intrumentation + options.webpack.babel = { + plugins: [['coverage', { ignore: ['test/'] }]] + } + + config.set(options) +} diff --git a/template/package.json b/template/package.json index 986b0ad..a1667e1 100644 --- a/template/package.json +++ b/template/package.json @@ -42,6 +42,9 @@ "karma": "^0.13.9", "karma-chrome-launcher": "^1.0.1", "karma-coverage": "^1.0.0", + {{#coveralls}} + "karma-coveralls": "^1.1.2", + {{/coveralls}} "karma-firefox-launcher": "^1.0.0", "karma-jasmine": "^1.0.2", "karma-phantomjs-launcher": "^1.0.0", @@ -124,6 +127,9 @@ {{/sauce}} "test": "npm run lint && {{#flow}}npm run flow && {{/flow}}npm run test:unit{{#e2e}} && npm run test:e2e{{/e2e}}", "test:cover": "NODE_ENV=development karma start config/karma.cover.conf.js", + {{#coveralls}} + "test:coveralls": "NODE_ENV=development karma start config/karma.coveralls.conf.js", + {{/coveralls}} {{#e2e}} "test:e2e": "npm run build && node test/e2e/runner.js", {{/e2e}}