我的问题是:在一个AngularJS项目中,我使用Babel 6 (ES2015 + stage3 +装饰器)、SystemJS和Karma + Jasmine。
除了代码覆盖率之外,一切都很好:我找不到一种好的方法来获得ES6代码上的覆盖率报告,而不是转移的ES5。
我有一些限制:
这个问题特别适合本地html覆盖率报告,但我也需要一种可以在SonarQube中使用的格式。
在这个问题上,似乎有一个巨大的支持湖(尤其是在Decorator和SystemJS上),因此,除了一些关于Github的问题之外,堆栈溢出社区也许可以共享一种方法来实现这一点。
如果您需要一些额外的,您可以看到这个项目的Github (Sedona-解决方案/sdn-angularjs-种子),并查看相关的问题(Sedona-Solutions/sdn-angularjs-种子#5)与引用所有相关的问题和项目,我可以找到。
关于重新地图-伊斯坦布尔
这是我的转移溢出和映射吞咽任务:
gulp.task('es6', function () {
return gulp.src(paths.source, { base: 'app' })
.pipe(plumber())
.pipe(changed(paths.output, { extension: '.js' }))
.pipe(sourcemaps.init())
.pipe(babel(compilerOptions))
.pipe(ngAnnotate({
sourceMap: true,
gulpWarnings: false
}))
.pipe(sourcemaps.write("."))
.pipe(gulp.dest(paths.output))
});业力覆盖
coverageReporter: {
reporters: [
{
type: 'json',
dir: 'target/coverage/',
subdir: '.',
file: 'coverage-final.json'
}
]
}测试:重新映射吞咽任务:
gulp.task('test:remap', ['test'], function (done) {
return gulp.src(paths.coverage + '/coverage-final.json')
.pipe(remapIstanbul({
reports: {
'json': paths.coverage + '/coverage.json',
'html': paths.coverage + '/html-remaped/'
},
fail: true,
useAbsolutePaths: true
}));
});由于第一次重新规划-伊斯坦布尔问题,我得到以下错误:
C:\...\sdn-angularjs-seed\node_modules\remap-istanbul\node_modules\istanbul\lib\report\html.js:288
text = structuredText[startLine].text;
^
TypeError: Cannot read property 'text' of undefined
at C:\...\sdn-angularjs-seed\node_modules\remap-istanbul\node_modules\istanbul\lib\report\html.js:288:53您可以看到相应的代码论github。
这可能是某些映射生成或路径上的错误.如果你这么想,告诉我。
发布于 2016-06-23 21:09:47
因果报应-覆盖+重新地图-伊斯坦布尔应该运行良好
https://stackoverflow.com/questions/37985474
复制相似问题