mirror of https://github.com/keeweb/keeweb
fixed test runner fatal error reporting
parent
974dbd224a
commit
85a67b533a
|
@ -1,4 +1,14 @@
|
|||
function requireAll(req) {
|
||||
req.keys().forEach(req);
|
||||
req.keys().forEach((mod) => {
|
||||
try {
|
||||
req(mod);
|
||||
} catch (ex) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Error while running test', mod, ex.toString());
|
||||
if ('testErrors' in global) {
|
||||
global.testErrors++;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
requireAll(require.context('test/src/', true, /\.js$/));
|
||||
|
|
|
@ -23,11 +23,15 @@
|
|||
<script class="mocha-init">
|
||||
mocha.setup('bdd');
|
||||
mocha.checkLeaks();
|
||||
window.testErrors = 0;
|
||||
</script>
|
||||
<script src="dist/test.bundle.js"></script>
|
||||
<script class="mocha-exec">
|
||||
mocha.reporter('spec');
|
||||
mocha.run(failures => (window.done = { failures }));
|
||||
mocha.run((failures) => {
|
||||
failures += window.testErrors;
|
||||
window.done = { failures };
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue