Skip to content

Commit

Permalink
created bar ontop of page that turns red when tests fail
Browse files Browse the repository at this point in the history
recreated pr

feat: removed tests

setup scaffolding for testing error

restored back to previous config

set back to original package-lock.json

set test back to original state

wrote basic tests

added timeout for driver cleanup

set timeout to time for first driver to close
  • Loading branch information
dhuang612 committed Aug 26, 2021
1 parent 21cda3e commit c44aa80
Show file tree
Hide file tree
Showing 5 changed files with 343 additions and 33 deletions.
7 changes: 4 additions & 3 deletions lib/reporters/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ exports = module.exports = HTML;
/**
* Stats template.
*/

var statsBar = '<div id="progress-bar"></div>';
var statsTemplate =
'<ul id="mocha-stats">' +
'<li class="progress"><canvas width="40" height="40"></canvas></li>' +
Expand All @@ -61,6 +61,7 @@ function HTML(runner, options) {

var self = this;
var stats = this.stats;
var results = fragment(statsBar);
var stat = fragment(statsTemplate);
var items = stat.getElementsByTagName('li');
var passes = items[1].getElementsByTagName('em')[0];
Expand Down Expand Up @@ -111,7 +112,7 @@ function HTML(runner, options) {
hideSuitesWithout('test fail');
}
});

root.appendChild(results);
root.appendChild(stat);
root.appendChild(report);

Expand Down Expand Up @@ -209,7 +210,7 @@ function HTML(runner, options) {
fragment('<pre class="error">%e%e</pre>', message, stackString)
);
}

results.className += ' error';
self.addCodeToggle(el, test.body);
appendToStack(el);
updateStats();
Expand Down
16 changes: 16 additions & 0 deletions mocha.css
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,22 @@ body {
letter-spacing: 1px;
}

#progress-bar{
height: 15px;
border-radius: 5px;
border: solid #00e600;
padding: 5px 5px 5px 5px;
background-color: #00e600;
}

#progress-bar.error {
height: 15px;
border-radius: 5px;
border: solid #c00;
padding: 5px 5px 5px 5px;
background-color: #c00;
}

#mocha-stats {
position: fixed;
top: 15px;
Expand Down
Loading

0 comments on commit c44aa80

Please sign in to comment.