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

Commit

Permalink
Fix github failing tests for electron 9.4.1 upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
sadick254 committed Feb 25, 2021
1 parent 4ab44f3 commit 7113f20
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions test/views/github-dotcom-markdown.test.js
Expand Up @@ -140,6 +140,7 @@ describe('GithubDotcomMarkdown', function() {
});

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

Expand Down
22 changes: 12 additions & 10 deletions test/worker-manager.test.js
Expand Up @@ -151,23 +151,25 @@ describe('WorkerManager', function() {
it('destroys all the renderer processes that were created', async function() {
this.retries(5); // FLAKE

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

const script = `
const ipc = require('electron').ipcRenderer;
ipc.on('${Worker.channelName}', function() {
const args = Array.prototype.slice.apply(arguments)
args.shift();
args.unshift('${Worker.channelName}');
args.unshift(${remote.getCurrentWebContents().id})
ipc.sendTo.apply(ipc, args);
});
(function() {
ipc.on('${Worker.channelName}', function() {
const args = Array.prototype.slice.apply(arguments)
args.shift();
args.unshift('${Worker.channelName}');
args.unshift(${remote.getCurrentWebContents().id})
ipc.sendTo.apply(ipc, args);
});
})()
`;

await new Promise(resolve => browserWindow.webContents.executeJavaScript(script, resolve));
await browserWindow.webContents.executeJavaScript(script);

workerManager.destroy(true);
workerManager = new WorkerManager();
Expand Down

0 comments on commit 7113f20

Please sign in to comment.