2016-03-21 39 views
0

我通过文档阅读因缘伊斯坦布尔设置代码覆盖率设立伊斯坦布尔的窗口。我不知道我错过了什么。我包括了所有我已经习惯了的步骤,所以我很抱歉,如果它很长时间啰嗦。茉莉花2 /发现规格 SUPPORT jasmine.json

我试着运行我的NPM包内的启动脚本,但得到的错误消息

Error: Cannot find module 'c:\HA\VSTS\Applications\HA.Web.Main\spec\support\jasmine.json' 

- https://karma-runner.github.io/0.8/config/coverage.html

- https://www.npmjs.com/package/istanbul#getting-started

这似乎是它应该是一个相当简单的处理。

里面我karma.conf文件我有因缘覆盖

plugins: { 
    karma-coverage 
] 

我建立了一个覆盖reporter的对象

coverageReporter: { 
    // disable code compaction when using instrumenter * do not want ot minify output 
    instrumenterOptions: { 
     istanbul: { noCompact: true } 
    }, 
    type: 'html', 
    dir: 'coverage/' 
}, 

里面的预处理器的我列出我想要的文件覆盖

preprocessor: [  

"../Scripts/src/modules/**/*.js": ['coverage'] 

] 

该文档记录窗口上的茉莉花,并确定th e需要一个脚本对象来使用跨平台。

"scripts": { 
    "test": "istanbul cover node_modules/jasmine/bin/jasmine.js" 
}, 

我在我的节点模块中有茉莉花,所以不应该是一个问题。

我跑了进一步确定可能是什么问题。

istanbul help config 

但说实话,我现在不看什么的一些对象

verbose: false 
instrumentation: 
    root: . 
    extensions: 
     - .js 
    default-excludes: true 
    excludes: [] 
    embed-source: false 
    variable: __coverage__ 
    compact: true 
    preserve-comments: false 
    complete-copy: false 
    save-baseline: false 
    baseline-file: ./coverage/coverage-baseline.json 
    include-all-sources: false 
    include-pid: false 
    es-modules: false 
reporting: 
    print: summary 
    reports: 
     - lcov 
    dir: ./coverage 
    watermarks: 
     statements: [50, 80] 
     lines: [50, 80] 
     functions: [50, 80] 
     branches: [50, 80] 
    report-config: 
     clover: {file: clover.xml} 
     cobertura: {file: cobertura-coverage.xml} 
     json: {file: coverage-final.json} 
     json-summary: {file: coverage-summary.json} 
     lcovonly: {file: lcov.info} 
     teamcity: {file: null, blockName: Code Coverage Summary} 
     text: {file: null, maxCols: 0} 
     text-lcov: {file: lcov.info} 
     text-summary: {file: null} 
hooks: 
    hook-run-in-context: false 
    post-require-hook: null 
    handle-sigint: false 
check: 
    global: 
     statements: 0 
     lines: 0 
     branches: 0 
     functions: 0 
     excludes: [] 
    each: 
     statements: 0 
     lines: 0 
     branches: 0 
     functions: 0 
     excludes: [] 
+0

我必须使用命令行运行时伊斯坦布尔同样的错误:'node_modules /伊斯坦布尔/ lib中/ cli.js覆盖node_modules /茉莉/斌/ jasmine.js' – jcubic

回答

1

需要调用jasmine init生成的文件里。如果本地安装茉莉花你需要调用:

node_modules/jasmine/bin/jasmine.js init