Log all crashes during specs
authorKevin Sawicki <kevinsawicki@gmail.com>
Fri, 21 Apr 2017 19:29:46 +0000 (12:29 -0700)
committerKevin Sawicki <kevinsawicki@gmail.com>
Mon, 24 Apr 2017 16:26:24 +0000 (09:26 -0700)
spec/static/main.js

index 033a0c5546cf3b8dfcb98fd344036f61f6f9e524..7e56da623bf853bcf60ab38effd1268c99458d37 100644 (file)
@@ -2,20 +2,15 @@
 process.throwDeprecation = true
 
 const electron = require('electron')
-const app = electron.app
-const crashReporter = electron.crashReporter
-const ipcMain = electron.ipcMain
-const dialog = electron.dialog
-const BrowserWindow = electron.BrowserWindow
-const protocol = electron.protocol
-const webContents = electron.webContents
-const v8 = require('v8')
+const {app, BrowserWindow, crashReporter, dialog, ipcMain, protocol, webContents} = electron
+
+const {Coverage} = require('electabul')
 
-const Coverage = require('electabul').Coverage
 const fs = require('fs')
 const path = require('path')
 const url = require('url')
 const util = require('util')
+const v8 = require('v8')
 
 var argv = require('yargs')
   .boolean('ci')
@@ -103,6 +98,12 @@ app.on('window-all-closed', function () {
   app.quit()
 })
 
+app.on('web-contents-created', (event, contents) => {
+  contents.on('crashed', (event, killed) => {
+    console.log(`webContents ${contents.id} crashed: ${contents.getURL()} (killed=${killed})`)
+  })
+})
+
 app.on('ready', function () {
   // Test if using protocol module would crash.
   electron.protocol.registerStringProtocol('test-if-crashes', function () {})