1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', {
|
4 | value: true
|
5 | });
|
6 | exports.default = getWatermarks;
|
7 | function _istanbulLibReport() {
|
8 | const data = _interopRequireDefault(require('istanbul-lib-report'));
|
9 | _istanbulLibReport = function () {
|
10 | return data;
|
11 | };
|
12 | return data;
|
13 | }
|
14 | function _interopRequireDefault(obj) {
|
15 | return obj && obj.__esModule ? obj : {default: obj};
|
16 | }
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | function getWatermarks(config) {
|
25 | const defaultWatermarks = _istanbulLibReport().default.getDefaultWatermarks();
|
26 | const {coverageThreshold} = config;
|
27 | if (!coverageThreshold || !coverageThreshold.global) {
|
28 | return defaultWatermarks;
|
29 | }
|
30 | const keys = ['branches', 'functions', 'lines', 'statements'];
|
31 | return keys.reduce((watermarks, key) => {
|
32 | const value = coverageThreshold.global[key];
|
33 | if (value !== undefined) {
|
34 | watermarks[key][1] = value;
|
35 | }
|
36 | return watermarks;
|
37 | }, defaultWatermarks);
|
38 | }
|