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

Fix github failing tests for Atom's electron 9.4.1 upgrade #2631

Merged
merged 1 commit into from
Feb 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions test/views/github-dotcom-markdown.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ describe('GithubDotcomMarkdown', function() {
});

it('opens item in pane and activates accordingly', async function() {
atom.workspace = {open: () => {}};
sadick254 marked this conversation as resolved.
Show resolved Hide resolved
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
Original file line number Diff line number Diff line change
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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, missed this one in the other pass, I see.


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