react / wstein / node_modules / jest-cli / node_modules / istanbul / lib / report / common / defaults.js
80684 views/*1Copyright (c) 2013, Yahoo! Inc. All rights reserved.2Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.3*/45var Report = require('../index');6var supportsColor = require('supports-color');78module.exports = {9watermarks: function () {10return {11statements: [ 50, 80 ],12lines: [ 50, 80 ],13functions: [ 50, 80],14branches: [ 50, 80 ]15};16},1718classFor: function (type, metrics, watermarks) {19var mark = watermarks[type],20value = metrics[type].pct;21return value >= mark[1] ? 'high' : value >= mark[0] ? 'medium' : 'low';22},2324colorize: function (str, clazz) {25/* istanbul ignore if: untestable in batch mode */26if (supportsColor) {27switch (clazz) {28case 'low' : str = '\033[91m' + str + '\033[0m'; break;29case 'medium': str = '\033[93m' + str + '\033[0m'; break;30case 'high': str = '\033[92m' + str + '\033[0m'; break;31}32}33return str;34},3536defaultReportConfig: function () {37var cfg = {};38Report.getReportList().forEach(function (type) {39var rpt = Report.create(type),40c = rpt.getDefaultConfig();41if (c) {42cfg[type] = c;43}44});45return cfg;46}47};48495051