Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 7113f20

Browse files
committed
Fix github failing tests for electron 9.4.1 upgrade
1 parent 4ab44f3 commit 7113f20

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

test/views/github-dotcom-markdown.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ describe('GithubDotcomMarkdown', function() {
140140
});
141141

142142
it('opens item in pane and activates accordingly', async function() {
143+
atom.workspace = {open: () => {}};
143144
sinon.stub(atom.workspace, 'open').returns(Promise.resolve());
144145
const issueishLink = wrapper.getDOMNode().querySelector('a.issue-link');
145146

test/worker-manager.test.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -151,23 +151,25 @@ describe('WorkerManager', function() {
151151
it('destroys all the renderer processes that were created', async function() {
152152
this.retries(5); // FLAKE
153153

154-
const browserWindow = new BrowserWindow({show: !!process.env.ATOM_GITHUB_SHOW_RENDERER_WINDOW, webPreferences: {nodeIntegration: true}});
154+
const browserWindow = new BrowserWindow({show: !!process.env.ATOM_GITHUB_SHOW_RENDERER_WINDOW, webPreferences: {nodeIntegration: true, enableRemoteModule: true}});
155155
browserWindow.loadURL('about:blank');
156156
sinon.stub(Worker.prototype, 'getWebContentsId').returns(browserWindow.webContents.id);
157157

158158
const script = `
159159
const ipc = require('electron').ipcRenderer;
160-
ipc.on('${Worker.channelName}', function() {
161-
const args = Array.prototype.slice.apply(arguments)
162-
args.shift();
163-
164-
args.unshift('${Worker.channelName}');
165-
args.unshift(${remote.getCurrentWebContents().id})
166-
ipc.sendTo.apply(ipc, args);
167-
});
160+
(function() {
161+
ipc.on('${Worker.channelName}', function() {
162+
const args = Array.prototype.slice.apply(arguments)
163+
args.shift();
164+
165+
args.unshift('${Worker.channelName}');
166+
args.unshift(${remote.getCurrentWebContents().id})
167+
ipc.sendTo.apply(ipc, args);
168+
});
169+
})()
168170
`;
169171

170-
await new Promise(resolve => browserWindow.webContents.executeJavaScript(script, resolve));
172+
await browserWindow.webContents.executeJavaScript(script);
171173

172174
workerManager.destroy(true);
173175
workerManager = new WorkerManager();

0 commit comments

Comments
 (0)