feat(omiv): add coverage:test script

This commit is contained in:
mrjzhang 2019-11-17 15:42:43 +08:00
parent 294d38d0a8
commit 94695a0af5
2 changed files with 11 additions and 14 deletions

View File

@ -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",

View File

@ -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