testit/test/runner.js

16 lines
510 B
JavaScript
Raw Permalink Normal View History

2020-09-20 19:58:00 +00:00
import spec from "./index.spec.js";
spec.run(false, function (r) {
let errors = [];
document.body.style.backgroundColor = (
r.fail.length ? "#ff9999" : "#99ff99"
);
r.pass.forEach((p) => errors.push(`<br>${p}`));
r.fail.forEach((f) => errors.push(`<br><b>${f}</b>`));
document.querySelector('#errors').innerHTML = errors;
document.querySelector('#summary').innerHTML = `| tests: ${r.pass.length + r.fail.length} | pass: ${r.pass.length} | fail: ${r.fail.length} |`;
});