From e034bd05d39e93c7594ba8491002f94ede897b23 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 2 Aug 2016 16:50:39 -0700 Subject: [PATCH] Save type in coverage filename --- spec/coverage/reporter.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/coverage/reporter.js b/spec/coverage/reporter.js index 4487c3cdf56e..8593b29f4cf4 100644 --- a/spec/coverage/reporter.js +++ b/spec/coverage/reporter.js @@ -64,9 +64,9 @@ exports.generateReport = () => { } // Save coverage data from the browser window with the given pid -const saveCoverageData = (coverage, pid) => { +const saveCoverageData = (webContents, coverage, pid) => { if (coverage && pid) { - const dataPath = path.join(outputPath, 'data', `${pid}-${Date.now()}.json`) + const dataPath = path.join(outputPath, 'data', `${pid || webContents.getId()}-${webContents.getType()}-${Date.now()}.json`) mkdirp.sync(path.dirname(dataPath)) fs.writeFileSync(dataPath, JSON.stringify(coverage)) } @@ -75,7 +75,7 @@ const saveCoverageData = (coverage, pid) => { const getCoverageFromWebContents = (webContents, callback) => { webContents.executeJavaScript('[window.__coverage__, window.process && window.process.pid]', (results) => { const coverage = results[0] - const pid = results[1] || webContents.getId() + const pid = results[1] callback(coverage, pid) }) } @@ -91,7 +91,7 @@ const patchBrowserWindow = () => { } getCoverageFromWebContents(this.webContents, (coverage, pid) => { - saveCoverageData(coverage, pid) + saveCoverageData(this.webContents, coverage, pid) destroy.call(this) }) } @@ -102,7 +102,7 @@ const saveCoverageOnBeforeUnload = () => { const {app, ipcMain} = require('electron') ipcMain.on('save-coverage', function (event, coverage, pid) { - saveCoverageData(coverage, pid || event.sender.getId()) + saveCoverageData(event.sender, coverage, pid) }) app.on('web-contents-created', function (event, webContents) {