istanbul-text-full-reporter

2019-01-13 admin

istanbul-text-full-reporter是什么

什么是istanbul-text-full-reporter,Text based coverage reporter for Istanbul code coverage

istanbul-text-full-reporter使用教程帮助文档

Istanbul text-full reporter

Text based coverage reporter for Istanbul code coverage

With istanbul

To register and use with istanbul:

var report = require('istanbul-text-full-reporter');
istanbul.Report.register(report);

var reporter = new istanbul.Reporter();
reporter.add('text-full');
reporter.write(collector, false, function() {
    console.log('Report written');
});

You can also provide options to the reporter:

var reporter = new istanbul.Reporter({
    root: '/path/to/project'
    thresholds: {
        global: {
            statements: 100,
            branches: 100,
            lines: 100,
            functions: 100
        },
        each: {
            statements: 100,
            branches: 100,
            lines: 100,
            functions: 100
        }
    }
});

  • root defines the project root, file paths are shown relative to this directory, defaults to the process directory
  • thresholds can be defined with positive percentages or negative values (for number of allowed coverage gaps), defaults to 100% for all thresholds

With gulp istanbul

Add as a value in the reporter array option:

var report = require('istanbul-text-full-reporter');
gulp.src(['example.js'])
    .pipe(mocha())
    .pipe(gulpIstanbul.writeReports({
        reporters: [report]
    }));

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-50882.html

文章标题:istanbul-text-full-reporter

回到顶部