Tag: jscoverage

摩卡和JSCover

我正在使用摩卡testing我的nodejs代码。 我想获得一份报道。 我find了我试图运行的JSCover 。 但是我越来越 ReferenceError: _$jscoverage is not defined 我正在执行: java -jar ../tools/jscover/JSCover-all.jar –no-instrument=node_modules -fs api/ api-coverage test: @NODE_ENV=test ./node_modules/.bin/mocha \ –require expect.js \ –reporter $(REPORTER) \ –timeout 2000 \ –growl \ $(TESTS) COVERAGE_ENABLED=1 $(MAKE) test REPORTER=html-file-cov 任何帮助?

代码覆盖率在unit testing

我试图得到我的unit testing不包括的代码行。 我用摩卡进行unit testing,它提供了一个记者“json-cov”,它应该报告我没有执行的行数。 我有两个文件,第一个(foo.js): module.exports = function () { for (var result = 0, i = 0; i < arguments.length; i++) { result += arguments[i]; } return result; } 和第二个(test.js): var expect = require('expect.js'), jsc = require('jscoverage'), //foo = require('./foo.js'); foo = jsc.require(module, './foo.js'); describe('foo', function () { it('should add all arguments', function () […]

我可以使用伊斯坦布尔为摩卡html-cov的仪器

我正在尝试使用istanbul instrument输出mocha -R html-cov但不能得到它的工作。 我的testing脚本是: test: post: – node_modules/.bin/istanbul cover node_modules/.bin/_mocha -dir $CIRCLE_ARTIFACTS — -u exports -R spec – node_modules/.bin/istanbul instrument . -o lib-cov – cp package.json lib-cov/ # needs to be copied manually – MY_LIB_COV=1 node_modules/.bin/mocha -R html-cov > $CIRCLE_ARTIFACTS/coverage.html 我的testing有以下开关: var mylib = process.env.MY_LIB_COV ? require('../lib-cov') : require('../'); 伊斯坦布尔在lcov-report/index.html给了我一个很好的输出。 摩卡的html-cov在coverage.html给了我'0%覆盖率0 SLOC' 伊斯坦布尔的lcov报告是丑陋的。 我想用漂亮的mocha […]