diff --git a/spec/coverage/reporter.js b/spec/coverage/reporter.js index 384e99fc1269..e813eed52d12 100644 --- a/spec/coverage/reporter.js +++ b/spec/coverage/reporter.js @@ -86,7 +86,10 @@ const patchBrowserWindow = () => { const {destroy} = BrowserWindow.prototype BrowserWindow.prototype.destroy = function () { - if (this.isDestroyed()) return destroy.call(this) + if (this.isDestroyed() || !this.getURL()) { + return destroy.call(this) + } + getCoverageFromWebContents(this.webContents, (coverage, pid) => { saveCoverageData(coverage, pid) destroy.call(this)