Save dev tools coverage when available
This commit is contained in:
parent
e034bd05d3
commit
9aec425ea8
1 changed files with 15 additions and 3 deletions
|
@ -80,6 +80,13 @@ const getCoverageFromWebContents = (webContents, callback) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const saveWebContentsCoverage = (webContents, callback) => {
|
||||||
|
getCoverageFromWebContents(webContents, (coverage, pid) => {
|
||||||
|
saveCoverageData(webContents, coverage, pid)
|
||||||
|
callback()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Save coverage data when a BrowserWindow is closed manually
|
// Save coverage data when a BrowserWindow is closed manually
|
||||||
const patchBrowserWindow = () => {
|
const patchBrowserWindow = () => {
|
||||||
const {BrowserWindow} = require('electron')
|
const {BrowserWindow} = require('electron')
|
||||||
|
@ -90,10 +97,15 @@ const patchBrowserWindow = () => {
|
||||||
return destroy.call(this)
|
return destroy.call(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
getCoverageFromWebContents(this.webContents, (coverage, pid) => {
|
saveWebContentsCoverage(this.webContents, () => {
|
||||||
saveCoverageData(this.webContents, coverage, pid)
|
if (this.devToolsWebContents) {
|
||||||
|
saveWebContentsCoverage(this.devToolsWebContents, () => {
|
||||||
destroy.call(this)
|
destroy.call(this)
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
destroy.call(this)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue