From 87bd0501c47a920d45c8aeeb88452bc9016419b2 Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Fri, 4 Oct 2019 13:58:44 -0700 Subject: [PATCH] test: remove 'remote' usage from process tests (#20418) --- spec/api-process-spec.js | 6 +++--- spec/static/main.js | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/spec/api-process-spec.js b/spec/api-process-spec.js index d49bbe3fff78..a6ae4df692ea 100644 --- a/spec/api-process-spec.js +++ b/spec/api-process-spec.js @@ -1,4 +1,4 @@ -const { remote } = require('electron') +const { ipcRenderer } = require('electron') const fs = require('fs') const path = require('path') @@ -89,8 +89,8 @@ describe('process module', () => { }) describe('process.takeHeapSnapshot()', () => { - it('returns true on success', () => { - const filePath = path.join(remote.app.getPath('temp'), 'test.heapsnapshot') + it('returns true on success', async () => { + const filePath = path.join(await ipcRenderer.invoke('get-temp-dir'), 'test.heapsnapshot') const cleanup = () => { try { diff --git a/spec/static/main.js b/spec/static/main.js index 38999ad2e3d8..5771f095dec5 100644 --- a/spec/static/main.js +++ b/spec/static/main.js @@ -42,6 +42,8 @@ ipcMain.on('message', function (event, ...args) { event.sender.send('message', ...args) }) +ipcMain.handle('get-temp-dir', () => app.getPath('temp')) + // Set productName so getUploadedReports() uses the right directory in specs if (process.platform !== 'darwin') { crashReporter.productName = 'Zombies'