UNPKG

1.73 kBJavaScriptView Raw
1/*
2 Copyright 2012-2015, Yahoo Inc.
3 Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
4 */
5"use strict";
6
7/**
8 * @module Exports
9 */
10
11var summarizer = require('./lib/summarizer'),
12 context = require('./lib/context'),
13 watermarks = require('./lib/watermarks');
14
15module.exports = {
16 /**
17 * returns a reporting context for the supplied options
18 * @param {Object} [opts=null] opts
19 * @returns {Context}
20 */
21 createContext: function (opts) {
22 return context.create(opts);
23 },
24 /**
25 * returns the default watermarks that would be used when not
26 * overridden
27 * @returns {Object} an object with `statements`, `functions`, `branches`,
28 * and `line` keys. Each value is a 2 element array that has the low and
29 * high watermark as percentages.
30 */
31 getDefaultWatermarks: function () {
32 return watermarks.getDefault();
33 }
34};
35/**
36 * standard summary functions
37 */
38module.exports.summarizers = {
39 /**
40 * a summarizer that creates a flat tree with one root node and bunch of
41 * files directly under it
42 */
43 flat: summarizer.createFlatSummary,
44 /**
45 * a summarizer that creates a hierarchical tree where the coverage summaries
46 * of each directly reflect the summaries of all subdirectories and files in it
47 */
48 nested: summarizer.createNestedSummary,
49 /**
50 * a summarizer that creates a tree in which directories are not nested.
51 * Every subdirectory is a child of the root node and only reflects the
52 * coverage numbers for the files in it (i.e. excludes subdirectories).
53 * This is the default summarizer.
54 */
55 pkg: summarizer.createPackageSummary
56};
57
58