Skip to content

Commit b46e892

Browse files
committedJan 15, 2021
feat: Add coverage section to README
Added dependencies - nyc - istanbul-badges-readme Added commands - coverage:report - coverage:badge
1 parent feb0664 commit b46e892

19 files changed

+1639
-0
lines changed
 

‎.nyc_output/9bba3810-e97f-46c5-ae00-ccdb2807135a.json

+1
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"parent":"bd08283b-0c2d-4ee4-afb3-a3338eed383b","pid":74606,"argv":["/Users/henry.steinhauer/.asdf/installs/nodejs/10.1.0/bin/node","/Users/henry.steinhauer/Projekte/private_Projekte/swagger-ui-express/node_modules/mocha/bin/_mocha","test/test.spec.js","test/testapp"],"execArgv":[],"cwd":"/Users/henry.steinhauer/Projekte/private_Projekte/swagger-ui-express","time":1610703806034,"ppid":74604,"coverageFilename":"/Users/henry.steinhauer/Projekte/private_Projekte/swagger-ui-express/.nyc_output/9bba3810-e97f-46c5-ae00-ccdb2807135a.json","externalId":"","uuid":"9bba3810-e97f-46c5-ae00-ccdb2807135a","files":["/Users/henry.steinhauer/Projekte/private_Projekte/swagger-ui-express/index.js"]}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"parent":null,"pid":74604,"argv":["/Users/henry.steinhauer/.asdf/installs/nodejs/10.1.0/bin/node","/Users/henry.steinhauer/Projekte/private_Projekte/swagger-ui-express/node_modules/.bin/mocha","test/test.spec.js","test/testapp"],"execArgv":[],"cwd":"/Users/henry.steinhauer/Projekte/private_Projekte/swagger-ui-express","time":1610703804065,"ppid":74573,"coverageFilename":"/Users/henry.steinhauer/Projekte/private_Projekte/swagger-ui-express/.nyc_output/bd08283b-0c2d-4ee4-afb3-a3338eed383b.json","externalId":"","uuid":"bd08283b-0c2d-4ee4-afb3-a3338eed383b","files":[]}

‎.nyc_output/processinfo/index.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"processes":{"9bba3810-e97f-46c5-ae00-ccdb2807135a":{"parent":"bd08283b-0c2d-4ee4-afb3-a3338eed383b","children":[]},"bd08283b-0c2d-4ee4-afb3-a3338eed383b":{"parent":null,"children":["9bba3810-e97f-46c5-ae00-ccdb2807135a"]}},"files":{"/Users/henry.steinhauer/Projekte/private_Projekte/swagger-ui-express/index.js":["9bba3810-e97f-46c5-ae00-ccdb2807135a"]},"externalIds":{}}

‎.nycrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"reporter": [
3+
"lcov",
4+
"json-summary"
5+
],
6+
"all": true
7+
}

‎README.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Swagger UI Express
22

3+
## Coverage
4+
5+
| Statements | Branches | Functions | Lines |
6+
| --------------------------- | ----------------------- | ------------------------- | -------------------- |
7+
| ![Statements](https://img.shields.io/badge/Coverage-89.87%25-yellow.svg) | ![Branches](https://img.shields.io/badge/Coverage-78.57%25-red.svg) | ![Functions](https://img.shields.io/badge/Coverage-91.67%25-brightgreen.svg) | ![Lines](https://img.shields.io/badge/Coverage-89.74%25-yellow.svg) |
8+
39
This module allows you to serve auto-generated [swagger-ui](https://swagger.io/tools/swagger-ui/) generated API docs from express, based on a `swagger.json` file. The result is living documentation for your API hosted from your API server via a route.
410

511
Swagger version is pulled from npm module swagger-ui-dist. Please use a lock file or specify the version of swagger-ui-dist you want to ensure it is consistent across environments.

‎coverage/coverage-summary.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{"total": {"lines":{"total":78,"covered":70,"skipped":0,"pct":89.74},"statements":{"total":79,"covered":71,"skipped":0,"pct":89.87},"functions":{"total":12,"covered":11,"skipped":0,"pct":91.67},"branches":{"total":56,"covered":44,"skipped":0,"pct":78.57}}
2+
,"/Users/henry.steinhauer/Projekte/private_Projekte/swagger-ui-express/index.js": {"lines":{"total":78,"covered":70,"skipped":0,"pct":89.74},"functions":{"total":12,"covered":11,"skipped":0,"pct":91.67},"statements":{"total":79,"covered":71,"skipped":0,"pct":89.87},"branches":{"total":56,"covered":44,"skipped":0,"pct":78.57}}
3+
}

‎coverage/lcov-report/base.css

+224
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
body, html {
2+
margin:0; padding: 0;
3+
height: 100%;
4+
}
5+
body {
6+
font-family: Helvetica Neue, Helvetica, Arial;
7+
font-size: 14px;
8+
color:#333;
9+
}
10+
.small { font-size: 12px; }
11+
*, *:after, *:before {
12+
-webkit-box-sizing:border-box;
13+
-moz-box-sizing:border-box;
14+
box-sizing:border-box;
15+
}
16+
h1 { font-size: 20px; margin: 0;}
17+
h2 { font-size: 14px; }
18+
pre {
19+
font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace;
20+
margin: 0;
21+
padding: 0;
22+
-moz-tab-size: 2;
23+
-o-tab-size: 2;
24+
tab-size: 2;
25+
}
26+
a { color:#0074D9; text-decoration:none; }
27+
a:hover { text-decoration:underline; }
28+
.strong { font-weight: bold; }
29+
.space-top1 { padding: 10px 0 0 0; }
30+
.pad2y { padding: 20px 0; }
31+
.pad1y { padding: 10px 0; }
32+
.pad2x { padding: 0 20px; }
33+
.pad2 { padding: 20px; }
34+
.pad1 { padding: 10px; }
35+
.space-left2 { padding-left:55px; }
36+
.space-right2 { padding-right:20px; }
37+
.center { text-align:center; }
38+
.clearfix { display:block; }
39+
.clearfix:after {
40+
content:'';
41+
display:block;
42+
height:0;
43+
clear:both;
44+
visibility:hidden;
45+
}
46+
.fl { float: left; }
47+
@media only screen and (max-width:640px) {
48+
.col3 { width:100%; max-width:100%; }
49+
.hide-mobile { display:none!important; }
50+
}
51+
52+
.quiet {
53+
color: #7f7f7f;
54+
color: rgba(0,0,0,0.5);
55+
}
56+
.quiet a { opacity: 0.7; }
57+
58+
.fraction {
59+
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
60+
font-size: 10px;
61+
color: #555;
62+
background: #E8E8E8;
63+
padding: 4px 5px;
64+
border-radius: 3px;
65+
vertical-align: middle;
66+
}
67+
68+
div.path a:link, div.path a:visited { color: #333; }
69+
table.coverage {
70+
border-collapse: collapse;
71+
margin: 10px 0 0 0;
72+
padding: 0;
73+
}
74+
75+
table.coverage td {
76+
margin: 0;
77+
padding: 0;
78+
vertical-align: top;
79+
}
80+
table.coverage td.line-count {
81+
text-align: right;
82+
padding: 0 5px 0 20px;
83+
}
84+
table.coverage td.line-coverage {
85+
text-align: right;
86+
padding-right: 10px;
87+
min-width:20px;
88+
}
89+
90+
table.coverage td span.cline-any {
91+
display: inline-block;
92+
padding: 0 5px;
93+
width: 100%;
94+
}
95+
.missing-if-branch {
96+
display: inline-block;
97+
margin-right: 5px;
98+
border-radius: 3px;
99+
position: relative;
100+
padding: 0 4px;
101+
background: #333;
102+
color: yellow;
103+
}
104+
105+
.skip-if-branch {
106+
display: none;
107+
margin-right: 10px;
108+
position: relative;
109+
padding: 0 4px;
110+
background: #ccc;
111+
color: white;
112+
}
113+
.missing-if-branch .typ, .skip-if-branch .typ {
114+
color: inherit !important;
115+
}
116+
.coverage-summary {
117+
border-collapse: collapse;
118+
width: 100%;
119+
}
120+
.coverage-summary tr { border-bottom: 1px solid #bbb; }
121+
.keyline-all { border: 1px solid #ddd; }
122+
.coverage-summary td, .coverage-summary th { padding: 10px; }
123+
.coverage-summary tbody { border: 1px solid #bbb; }
124+
.coverage-summary td { border-right: 1px solid #bbb; }
125+
.coverage-summary td:last-child { border-right: none; }
126+
.coverage-summary th {
127+
text-align: left;
128+
font-weight: normal;
129+
white-space: nowrap;
130+
}
131+
.coverage-summary th.file { border-right: none !important; }
132+
.coverage-summary th.pct { }
133+
.coverage-summary th.pic,
134+
.coverage-summary th.abs,
135+
.coverage-summary td.pct,
136+
.coverage-summary td.abs { text-align: right; }
137+
.coverage-summary td.file { white-space: nowrap; }
138+
.coverage-summary td.pic { min-width: 120px !important; }
139+
.coverage-summary tfoot td { }
140+
141+
.coverage-summary .sorter {
142+
height: 10px;
143+
width: 7px;
144+
display: inline-block;
145+
margin-left: 0.5em;
146+
background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
147+
}
148+
.coverage-summary .sorted .sorter {
149+
background-position: 0 -20px;
150+
}
151+
.coverage-summary .sorted-desc .sorter {
152+
background-position: 0 -10px;
153+
}
154+
.status-line { height: 10px; }
155+
/* yellow */
156+
.cbranch-no { background: yellow !important; color: #111; }
157+
/* dark red */
158+
.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 }
159+
.low .chart { border:1px solid #C21F39 }
160+
.highlighted,
161+
.highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{
162+
background: #C21F39 !important;
163+
}
164+
/* medium red */
165+
.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE }
166+
/* light red */
167+
.low, .cline-no { background:#FCE1E5 }
168+
/* light green */
169+
.high, .cline-yes { background:rgb(230,245,208) }
170+
/* medium green */
171+
.cstat-yes { background:rgb(161,215,106) }
172+
/* dark green */
173+
.status-line.high, .high .cover-fill { background:rgb(77,146,33) }
174+
.high .chart { border:1px solid rgb(77,146,33) }
175+
/* dark yellow (gold) */
176+
.status-line.medium, .medium .cover-fill { background: #f9cd0b; }
177+
.medium .chart { border:1px solid #f9cd0b; }
178+
/* light yellow */
179+
.medium { background: #fff4c2; }
180+
181+
.cstat-skip { background: #ddd; color: #111; }
182+
.fstat-skip { background: #ddd; color: #111 !important; }
183+
.cbranch-skip { background: #ddd !important; color: #111; }
184+
185+
span.cline-neutral { background: #eaeaea; }
186+
187+
.coverage-summary td.empty {
188+
opacity: .5;
189+
padding-top: 4px;
190+
padding-bottom: 4px;
191+
line-height: 1;
192+
color: #888;
193+
}
194+
195+
.cover-fill, .cover-empty {
196+
display:inline-block;
197+
height: 12px;
198+
}
199+
.chart {
200+
line-height: 0;
201+
}
202+
.cover-empty {
203+
background: white;
204+
}
205+
.cover-full {
206+
border-right: none !important;
207+
}
208+
pre.prettyprint {
209+
border: none !important;
210+
padding: 0 !important;
211+
margin: 0 !important;
212+
}
213+
.com { color: #999 !important; }
214+
.ignore-none { color: #999; font-weight: normal; }
215+
216+
.wrapper {
217+
min-height: 100%;
218+
height: auto !important;
219+
height: 100%;
220+
margin: 0 auto -48px;
221+
}
222+
.footer, .push {
223+
height: 48px;
224+
}
+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/* eslint-disable */
2+
var jumpToCode = (function init() {
3+
// Classes of code we would like to highlight in the file view
4+
var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no'];
5+
6+
// Elements to highlight in the file listing view
7+
var fileListingElements = ['td.pct.low'];
8+
9+
// We don't want to select elements that are direct descendants of another match
10+
var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > `
11+
12+
// Selecter that finds elements on the page to which we can jump
13+
var selector =
14+
fileListingElements.join(', ') +
15+
', ' +
16+
notSelector +
17+
missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b`
18+
19+
// The NodeList of matching elements
20+
var missingCoverageElements = document.querySelectorAll(selector);
21+
22+
var currentIndex;
23+
24+
function toggleClass(index) {
25+
missingCoverageElements
26+
.item(currentIndex)
27+
.classList.remove('highlighted');
28+
missingCoverageElements.item(index).classList.add('highlighted');
29+
}
30+
31+
function makeCurrent(index) {
32+
toggleClass(index);
33+
currentIndex = index;
34+
missingCoverageElements.item(index).scrollIntoView({
35+
behavior: 'smooth',
36+
block: 'center',
37+
inline: 'center'
38+
});
39+
}
40+
41+
function goToPrevious() {
42+
var nextIndex = 0;
43+
if (typeof currentIndex !== 'number' || currentIndex === 0) {
44+
nextIndex = missingCoverageElements.length - 1;
45+
} else if (missingCoverageElements.length > 1) {
46+
nextIndex = currentIndex - 1;
47+
}
48+
49+
makeCurrent(nextIndex);
50+
}
51+
52+
function goToNext() {
53+
var nextIndex = 0;
54+
55+
if (
56+
typeof currentIndex === 'number' &&
57+
currentIndex < missingCoverageElements.length - 1
58+
) {
59+
nextIndex = currentIndex + 1;
60+
}
61+
62+
makeCurrent(nextIndex);
63+
}
64+
65+
return function jump(event) {
66+
switch (event.which) {
67+
case 78: // n
68+
case 74: // j
69+
goToNext();
70+
break;
71+
case 66: // b
72+
case 75: // k
73+
case 80: // p
74+
goToPrevious();
75+
break;
76+
}
77+
};
78+
})();
79+
window.addEventListener('keydown', jumpToCode);

‎coverage/lcov-report/favicon.png

540 Bytes

Error rendering embedded code

Invalid image source.

‎coverage/lcov-report/index.html

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
2+
<!doctype html>
3+
<html lang="en">
4+
5+
<head>
6+
<title>Code coverage report for All files</title>
7+
<meta charset="utf-8" />
8+
<link rel="stylesheet" href="prettify.css" />
9+
<link rel="stylesheet" href="base.css" />
10+
<link rel="shortcut icon" type="image/x-icon" href="favicon.png" />
11+
<meta name="viewport" content="width=device-width, initial-scale=1" />
12+
<style type='text/css'>
13+
.coverage-summary .sorter {
14+
background-image: url(sort-arrow-sprite.png);
15+
}
16+
</style>
17+
</head>
18+
19+
<body>
20+
<div class='wrapper'>
21+
<div class='pad1'>
22+
<h1>All files</h1>
23+
<div class='clearfix'>
24+
25+
<div class='fl pad1y space-right2'>
26+
<span class="strong">89.87% </span>
27+
<span class="quiet">Statements</span>
28+
<span class='fraction'>71/79</span>
29+
</div>
30+
31+
32+
<div class='fl pad1y space-right2'>
33+
<span class="strong">78.57% </span>
34+
<span class="quiet">Branches</span>
35+
<span class='fraction'>44/56</span>
36+
</div>
37+
38+
39+
<div class='fl pad1y space-right2'>
40+
<span class="strong">91.67% </span>
41+
<span class="quiet">Functions</span>
42+
<span class='fraction'>11/12</span>
43+
</div>
44+
45+
46+
<div class='fl pad1y space-right2'>
47+
<span class="strong">89.74% </span>
48+
<span class="quiet">Lines</span>
49+
<span class='fraction'>70/78</span>
50+
</div>
51+
52+
53+
</div>
54+
<p class="quiet">
55+
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
56+
</p>
57+
</div>
58+
<div class='status-line high'></div>
59+
<div class="pad1">
60+
<table class="coverage-summary">
61+
<thead>
62+
<tr>
63+
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
64+
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
65+
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
66+
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
67+
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
68+
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
69+
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
70+
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
71+
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
72+
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
73+
</tr>
74+
</thead>
75+
<tbody><tr>
76+
<td class="file high" data-value="index.js"><a href="index.js.html">index.js</a></td>
77+
<td data-value="89.87" class="pic high">
78+
<div class="chart"><div class="cover-fill" style="width: 89%"></div><div class="cover-empty" style="width: 11%"></div></div>
79+
</td>
80+
<td data-value="89.87" class="pct high">89.87%</td>
81+
<td data-value="79" class="abs high">71/79</td>
82+
<td data-value="78.57" class="pct medium">78.57%</td>
83+
<td data-value="56" class="abs medium">44/56</td>
84+
<td data-value="91.67" class="pct high">91.67%</td>
85+
<td data-value="12" class="abs high">11/12</td>
86+
<td data-value="89.74" class="pct high">89.74%</td>
87+
<td data-value="78" class="abs high">70/78</td>
88+
</tr>
89+
90+
</tbody>
91+
</table>
92+
</div>
93+
<div class='push'></div><!-- for sticky footer -->
94+
</div><!-- /wrapper -->
95+
<div class='footer quiet pad2 space-top1 center small'>
96+
Code coverage generated by
97+
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
98+
at Fri Jan 15 2021 10:43:37 GMT+0100 (CET)
99+
</div>
100+
</div>
101+
<script src="prettify.js"></script>
102+
<script>
103+
window.onload = function () {
104+
prettyPrint();
105+
};
106+
</script>
107+
<script src="sorter.js"></script>
108+
<script src="block-navigation.js"></script>
109+
</body>
110+
</html>
111+

‎coverage/lcov-report/index.js.html

+860
Large diffs are not rendered by default.

‎coverage/lcov-report/prettify.css

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎coverage/lcov-report/prettify.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
209 Bytes

Error rendering embedded code

Invalid image source.

‎coverage/lcov-report/sorter.js

+170
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
/* eslint-disable */
2+
var addSorting = (function() {
3+
'use strict';
4+
var cols,
5+
currentSort = {
6+
index: 0,
7+
desc: false
8+
};
9+
10+
// returns the summary table element
11+
function getTable() {
12+
return document.querySelector('.coverage-summary');
13+
}
14+
// returns the thead element of the summary table
15+
function getTableHeader() {
16+
return getTable().querySelector('thead tr');
17+
}
18+
// returns the tbody element of the summary table
19+
function getTableBody() {
20+
return getTable().querySelector('tbody');
21+
}
22+
// returns the th element for nth column
23+
function getNthColumn(n) {
24+
return getTableHeader().querySelectorAll('th')[n];
25+
}
26+
27+
// loads all columns
28+
function loadColumns() {
29+
var colNodes = getTableHeader().querySelectorAll('th'),
30+
colNode,
31+
cols = [],
32+
col,
33+
i;
34+
35+
for (i = 0; i < colNodes.length; i += 1) {
36+
colNode = colNodes[i];
37+
col = {
38+
key: colNode.getAttribute('data-col'),
39+
sortable: !colNode.getAttribute('data-nosort'),
40+
type: colNode.getAttribute('data-type') || 'string'
41+
};
42+
cols.push(col);
43+
if (col.sortable) {
44+
col.defaultDescSort = col.type === 'number';
45+
colNode.innerHTML =
46+
colNode.innerHTML + '<span class="sorter"></span>';
47+
}
48+
}
49+
return cols;
50+
}
51+
// attaches a data attribute to every tr element with an object
52+
// of data values keyed by column name
53+
function loadRowData(tableRow) {
54+
var tableCols = tableRow.querySelectorAll('td'),
55+
colNode,
56+
col,
57+
data = {},
58+
i,
59+
val;
60+
for (i = 0; i < tableCols.length; i += 1) {
61+
colNode = tableCols[i];
62+
col = cols[i];
63+
val = colNode.getAttribute('data-value');
64+
if (col.type === 'number') {
65+
val = Number(val);
66+
}
67+
data[col.key] = val;
68+
}
69+
return data;
70+
}
71+
// loads all row data
72+
function loadData() {
73+
var rows = getTableBody().querySelectorAll('tr'),
74+
i;
75+
76+
for (i = 0; i < rows.length; i += 1) {
77+
rows[i].data = loadRowData(rows[i]);
78+
}
79+
}
80+
// sorts the table using the data for the ith column
81+
function sortByIndex(index, desc) {
82+
var key = cols[index].key,
83+
sorter = function(a, b) {
84+
a = a.data[key];
85+
b = b.data[key];
86+
return a < b ? -1 : a > b ? 1 : 0;
87+
},
88+
finalSorter = sorter,
89+
tableBody = document.querySelector('.coverage-summary tbody'),
90+
rowNodes = tableBody.querySelectorAll('tr'),
91+
rows = [],
92+
i;
93+
94+
if (desc) {
95+
finalSorter = function(a, b) {
96+
return -1 * sorter(a, b);
97+
};
98+
}
99+
100+
for (i = 0; i < rowNodes.length; i += 1) {
101+
rows.push(rowNodes[i]);
102+
tableBody.removeChild(rowNodes[i]);
103+
}
104+
105+
rows.sort(finalSorter);
106+
107+
for (i = 0; i < rows.length; i += 1) {
108+
tableBody.appendChild(rows[i]);
109+
}
110+
}
111+
// removes sort indicators for current column being sorted
112+
function removeSortIndicators() {
113+
var col = getNthColumn(currentSort.index),
114+
cls = col.className;
115+
116+
cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
117+
col.className = cls;
118+
}
119+
// adds sort indicators for current column being sorted
120+
function addSortIndicators() {
121+
getNthColumn(currentSort.index).className += currentSort.desc
122+
? ' sorted-desc'
123+
: ' sorted';
124+
}
125+
// adds event listeners for all sorter widgets
126+
function enableUI() {
127+
var i,
128+
el,
129+
ithSorter = function ithSorter(i) {
130+
var col = cols[i];
131+
132+
return function() {
133+
var desc = col.defaultDescSort;
134+
135+
if (currentSort.index === i) {
136+
desc = !currentSort.desc;
137+
}
138+
sortByIndex(i, desc);
139+
removeSortIndicators();
140+
currentSort.index = i;
141+
currentSort.desc = desc;
142+
addSortIndicators();
143+
};
144+
};
145+
for (i = 0; i < cols.length; i += 1) {
146+
if (cols[i].sortable) {
147+
// add the click event handler on the th so users
148+
// dont have to click on those tiny arrows
149+
el = getNthColumn(i).querySelector('.sorter').parentElement;
150+
if (el.addEventListener) {
151+
el.addEventListener('click', ithSorter(i));
152+
} else {
153+
el.attachEvent('onclick', ithSorter(i));
154+
}
155+
}
156+
}
157+
}
158+
// adds sorting functionality to the UI
159+
return function() {
160+
if (!getTable()) {
161+
return;
162+
}
163+
cols = loadColumns();
164+
loadData();
165+
addSortIndicators();
166+
enableUI();
167+
};
168+
})();
169+
170+
window.addEventListener('load', addSorting);

‎coverage/lcov.info

+167
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
TN:
2+
SF:index.js
3+
FN:136,(anonymous_0)
4+
FN:180,(anonymous_1)
5+
FN:182,(anonymous_2)
6+
FN:192,swaggerInitFn
7+
FN:203,(anonymous_4)
8+
FN:205,(anonymous_5)
9+
FN:217,(anonymous_6)
10+
FN:223,(anonymous_7)
11+
FN:236,(anonymous_8)
12+
FN:238,(anonymous_9)
13+
FN:241,(anonymous_10)
14+
FN:248,(anonymous_11)
15+
FNF:12
16+
FNH:11
17+
FNDA:9,(anonymous_0)
18+
FNDA:8,(anonymous_1)
19+
FNDA:4,(anonymous_2)
20+
FNDA:21,swaggerInitFn
21+
FNDA:1,(anonymous_4)
22+
FNDA:0,(anonymous_5)
23+
FNDA:3,(anonymous_6)
24+
FNDA:1,(anonymous_7)
25+
FNDA:1,(anonymous_8)
26+
FNDA:10,(anonymous_9)
27+
FNDA:417,(anonymous_10)
28+
FNDA:10,(anonymous_11)
29+
DA:3,1
30+
DA:4,1
31+
DA:5,1
32+
DA:7,1
33+
DA:9,1
34+
DA:90,1
35+
DA:136,1
36+
DA:141,9
37+
DA:142,4
38+
DA:143,4
39+
DA:144,4
40+
DA:145,4
41+
DA:146,4
42+
DA:147,4
43+
DA:148,4
44+
DA:149,4
45+
DA:150,4
46+
DA:153,5
47+
DA:155,9
48+
DA:156,9
49+
DA:157,9
50+
DA:158,9
51+
DA:159,9
52+
DA:160,9
53+
DA:161,9
54+
DA:163,9
55+
DA:164,9
56+
DA:165,9
57+
DA:166,9
58+
DA:167,9
59+
DA:169,9
60+
DA:176,9
61+
DA:177,9
62+
DA:180,1
63+
DA:181,8
64+
DA:182,8
65+
DA:183,4
66+
DA:184,0
67+
DA:185,0
68+
DA:187,4
69+
DA:193,21
70+
DA:194,1
71+
DA:195,20
72+
DA:196,4
73+
DA:197,4
74+
DA:199,16
75+
DA:203,1
76+
DA:204,1
77+
DA:205,1
78+
DA:206,0
79+
DA:207,0
80+
DA:208,0
81+
DA:209,0
82+
DA:210,0
83+
DA:212,0
84+
DA:217,1
85+
DA:218,3
86+
DA:219,3
87+
DA:220,3
88+
DA:223,1
89+
DA:224,1
90+
DA:225,1
91+
DA:231,1
92+
DA:232,1
93+
DA:235,1
94+
DA:236,1
95+
DA:238,1
96+
DA:239,10
97+
DA:240,10
98+
DA:241,10
99+
DA:242,417
100+
DA:243,10
101+
DA:244,10
102+
DA:246,407
103+
DA:248,10
104+
DA:249,10
105+
DA:251,10
106+
DA:254,1
107+
LF:78
108+
LH:70
109+
BRDA:141,0,0,4
110+
BRDA:141,0,1,5
111+
BRDA:141,1,0,9
112+
BRDA:141,1,1,4
113+
BRDA:148,2,0,4
114+
BRDA:148,2,1,4
115+
BRDA:155,3,0,9
116+
BRDA:155,3,1,0
117+
BRDA:156,4,0,0
118+
BRDA:156,4,1,9
119+
BRDA:157,5,0,9
120+
BRDA:157,5,1,0
121+
BRDA:158,6,0,9
122+
BRDA:158,6,1,9
123+
BRDA:159,7,0,9
124+
BRDA:159,7,1,9
125+
BRDA:160,8,0,9
126+
BRDA:160,8,1,1
127+
BRDA:161,9,0,9
128+
BRDA:161,9,1,1
129+
BRDA:163,10,0,0
130+
BRDA:163,10,1,9
131+
BRDA:166,11,0,2
132+
BRDA:166,11,1,7
133+
BRDA:167,12,0,2
134+
BRDA:167,12,1,7
135+
BRDA:170,13,0,9
136+
BRDA:170,13,1,3
137+
BRDA:172,14,0,9
138+
BRDA:172,14,1,6
139+
BRDA:173,15,0,9
140+
BRDA:173,15,1,9
141+
BRDA:183,16,0,0
142+
BRDA:183,16,1,4
143+
BRDA:193,17,0,1
144+
BRDA:193,17,1,20
145+
BRDA:195,18,0,4
146+
BRDA:195,18,1,16
147+
BRDA:206,19,0,0
148+
BRDA:206,19,1,0
149+
BRDA:208,20,0,0
150+
BRDA:208,20,1,0
151+
BRDA:218,21,0,3
152+
BRDA:218,21,1,2
153+
BRDA:224,22,0,1
154+
BRDA:224,22,1,0
155+
BRDA:226,23,0,1
156+
BRDA:226,23,1,0
157+
BRDA:227,24,0,1
158+
BRDA:227,24,1,0
159+
BRDA:228,25,0,1
160+
BRDA:228,25,1,1
161+
BRDA:229,26,0,1
162+
BRDA:229,26,1,1
163+
BRDA:242,27,0,10
164+
BRDA:242,27,1,407
165+
BRF:56
166+
BRH:44
167+
end_of_record

‎package.json

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
],
1313
"scripts": {
1414
"test": "./node_modules/.bin/mocha test/*",
15+
"coverage:report": "nyc ./node_modules/.bin/mocha test/* || exit 0",
16+
"coverage:badge": "npm run coverage:report && istanbul-badges-readme --coverageDir='./coverage'",
1517
"test-app": "node ./test/testapp/run.js "
1618
},
1719
"keywords": [
@@ -28,7 +30,9 @@
2830
"devDependencies": {
2931
"es6-shim": "0.35.2",
3032
"express": "4.12.2",
33+
"istanbul-badges-readme": "^1.2.0",
3134
"mocha": "2.2.5",
35+
"nyc": "^15.1.0",
3236
"phantom": "2.1.21"
3337
},
3438
"author": {

0 commit comments

Comments
 (0)
Please sign in to comment.