test: remove 'remote' usage from process tests (#20418)

This commit is contained in:
Jeremy Apthorp 2019-10-04 13:58:44 -07:00 committed by GitHub
parent ccff140046
commit 87bd0501c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -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 {

View file

@ -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'