diff --git a/spec/coverage/reporter.js b/spec/coverage/reporter.js index 2b7496270..af281784d 100644 --- a/spec/coverage/reporter.js +++ b/spec/coverage/reporter.js @@ -117,6 +117,10 @@ const saveCoverageOnBeforeUnload = () => { saveCoverageData(event.sender, coverage, pid) }) + ipcMain.on('report-coverage', function (event, message) { + saveCoverageData(event.sender, message.coverage, `${message.pid}-extension`) + }) + app.on('web-contents-created', function (event, webContents) { webContents.executeJavaScript(` window.addEventListener('beforeunload', function () { diff --git a/spec/fixtures/devtools-extensions/foo/index.html b/spec/fixtures/devtools-extensions/foo/index.html index 70db43a37..55d4664cc 100644 --- a/spec/fixtures/devtools-extensions/foo/index.html +++ b/spec/fixtures/devtools-extensions/foo/index.html @@ -16,6 +16,15 @@ }) } + function reportCoverage () { + var message = JSON.stringify({ + pid: chrome.runtime.id, + coverage: window.__coverage__ + }) + var coverageMessage = `require('electron').ipcRenderer.send('report-coverage', ${message})` + window.chrome.devtools.inspectedWindow.eval(coverageMessage, function () {}) + } + testStorage(function (syncItems, localItems) { var message = JSON.stringify({ runtimeId: chrome.runtime.id, @@ -26,6 +35,8 @@ sync: syncItems } }) + + reportCoverage() var sendMessage = `require('electron').ipcRenderer.send('answer', ${message})` window.chrome.devtools.inspectedWindow.eval(sendMessage, function () {}) })