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

Commit

Permalink
Merge pull request #2631 from atom/fix-tests
Browse files Browse the repository at this point in the history
Fix github failing tests for Atom's electron 9.4.1 upgrade
  • Loading branch information
smashwilson committed Feb 25, 2021
2 parents 3d54177 + 7113f20 commit 0c02e35
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 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
20 changes: 11 additions & 9 deletions test/worker-manager.test.js
Expand Up @@ -151,20 +151,22 @@ 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 browserWindow.webContents.executeJavaScript(script);
Expand Down

0 comments on commit 0c02e35

Please sign in to comment.