From 94695a0af51c5d67ddee44726b24b3b6abf1ed9d Mon Sep 17 00:00:00 2001 From: mrjzhang Date: Sun, 17 Nov 2019 15:42:43 +0800 Subject: [PATCH] feat(omiv): add coverage:test script --- packages/omiv/package.json | 1 + packages/omiv/test/karma.conf.js | 24 ++++++++++-------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/packages/omiv/package.json b/packages/omiv/package.json index e4be838e2..ca63e56fc 100644 --- a/packages/omiv/package.json +++ b/packages/omiv/package.json @@ -23,6 +23,7 @@ "strip": "npm-run-all strip:main strip:esm", "size": "node -e \"process.stdout.write('gzip size: ')\" && gzip-size --raw dist/omiv.min.js", "test": "karma start test/karma.conf.js --single-run", + "coverage:test": "cross-env COVERAGE=true karma start test/karma.conf.js --single-run", "fix": "eslint src --fix", "fix-e": "eslint examples --fix", "lint": "eslint src test", diff --git a/packages/omiv/test/karma.conf.js b/packages/omiv/test/karma.conf.js index 3ca696b2a..eb2a6f9eb 100755 --- a/packages/omiv/test/karma.conf.js +++ b/packages/omiv/test/karma.conf.js @@ -1,11 +1,11 @@ /*eslint no-var:0, object-shorthand:0 */ -//var coverage = String(process.env.COVERAGE) === 'true', -// ci = String(process.env.CI).match(/^(1|true)$/gi), -// pullRequest = !String(process.env.TRAVIS_PULL_REQUEST).match(/^(0|false|undefined)$/gi), -// masterBranch = String(process.env.TRAVIS_BRANCH).match(/^master$/gi), -// sauceLabs = ci && !pullRequest && masterBranch, -var coverage = false, +var coverage = String(process.env.COVERAGE) === 'true', + // ci = String(process.env.CI).match(/^(1|true)$/gi), + // pullRequest = !String(process.env.TRAVIS_PULL_REQUEST).match(/^(0|false|undefined)$/gi), + // masterBranch = String(process.env.TRAVIS_BRANCH).match(/^master$/gi), + // sauceLabs = ci && !pullRequest && masterBranch, + // var coverage = false, sauceLabs = false, performance = !coverage && String(process.env.PERFORMANCE) !== 'false', webpack = require('webpack'); @@ -67,14 +67,10 @@ module.exports = function (config) { sauceLabs ? 'saucelabs' : [] ), - // coverageReporter: { - // dir: __dirname+'/../coverage', - // reporters: [ - // { type: 'text-summary' }, - // { type: 'html' }, - // { type: 'lcovonly', subdir: '.', file: 'lcov.info' } - // ] - // }, + coverageReporter: { + dir: __dirname + '/../coverage', + reporters: [{ type: 'lcov', subdir: '.' }, { type: 'text-summary' }] + }, mochaReporter: { showDiff: true