better error handling in case of loader error in tests

This commit is contained in:
Joao Moreno 2019-06-24 07:47:26 -07:00
parent 59e50ff799
commit 18dfdcbf52
2 changed files with 15 additions and 1 deletions

View file

@ -100,6 +100,13 @@ function parseReporterOption(value) {
app.on('ready', () => {
ipcMain.on('error', (_, err) => {
if (!argv.debug) {
console.error(err);
app.exit(1);
}
});
const win = new BrowserWindow({
height: 600,
width: 800,

View file

@ -273,5 +273,12 @@ function runTests(opts) {
ipcRenderer.on('run', (e, opts) => {
initLoader(opts);
runTests(opts).catch(err => console.error(typeof err === 'string' ? err : JSON.stringify(err)));
runTests(opts).catch(err => {
if (!(typeof err !== 'string')) {
err = JSON.stringify(err);
}
console.error(err);
ipcRenderer.send('error', err);
});
});