Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

azuki-trusty / azk   deb

Repository URL to install this package:

Version: 0.5.1 

/ usr / lib / azk / node_modules / q-io / coverage-report.js


require("collections/shim");
var Q = require("q");
var FS = require("./fs");

FS.listTree(".coverage_data", function (name, stat) {
    return (/^\.coverage_data\/coveragefile/).test(name);
})
.then(function (list) {
    return Q.all(list.map(function (file) {
        return FS.read(file)
        .then(function (content) {
            return JSON.parse(content);
        })
        .then(function (coverage) {
            console.log("<table>");
            console.log("    <thead>");
            console.log("        <tr>");
            console.log("            <th>File</th>");
            console.log("            <th>Percentage</th>");
            console.log("            <th>Missing</th>");
            console.log("        </tr>");
            console.log("    </thead>");
            console.log("    <tbody>");
            Object.forEach(coverage.files, function (file, path) {
                path = FS.relativeFromDirectory(__dirname, path);
                if (/^spec/.test(path))
                    return;
                console.log("        <tr>");
                console.log("            <td><code>" + path + "</code></td>");
                console.log("            <td>" + (file.stats.percentage * 100).toFixed(0) + "%</td>");
                console.log("            <td>" + file.stats.missing + "</td>");
                console.log("        </tr>");
            });
            console.log("    </tbody>");
            console.log("</table>");
        }, function (error) {
            error.message = "Can't parse " + file + " because " + error.message;
            throw error;
        })
    }))
})
.done()