-
Notifications
You must be signed in to change notification settings - Fork 408
Update uses of Electron API calls that require Promises in Electron 7+ (callbacks are deprecated) #2624
Description
Summary
There are some Electron APIs that changed to only return Promises (and not run callbacks passed to them), mostly as of Electron 7+. Updating to be compatible with those would be great for updating Atom's Electron version.
Motivation
There is a Work In Progress pull request to update Atom to Electron 9, and I think updating these API calls may be necessary for the github package to continue to work with Electron 9. (atom/atom#21777)
Describe alternatives you've considered
N/A
Additional context
Most (I think all) of these API calls generally support Promises starting with Electron 6. (Some of them support Promises as of even earlier, in Electron 5.) So implementing these changes should still be compatible with all the current and in-development versions of Atom.
github's tests are failing over at Atom core's Electron 9 PR: atom/atom#21777 (comment)
Here are the error messages for the
githubpackage tests:
Error messages for the github package tests (click to expand):
2441 passing (15m)
1 pending
4 failing
1) GithubDotcomMarkdown
opening issueish links
opens item in pane and activates accordingly:
Error: Trying to stub property 'open' of null
at throwOnFalsyObject (/Users/runner/work/1/s/node_modules/github/node_modules/sinon/lib/sinon/throw-on-falsy-object.js:7:15)
at Function.stub (/Users/runner/work/1/s/node_modules/github/node_modules/sinon/lib/sinon/stub.js:70:24)
at Sandbox.stub (/Users/runner/work/1/s/node_modules/github/node_modules/sinon/lib/sinon/sandbox.js:331:37)
at Context.<anonymous> (/Users/runner/work/1/s/node_modules/github/github-dotcom-markdown.test.js:143:13)
at processImmediate (internal/timers.js:439:21)
2) GithubDotcomMarkdown
opening issueish links
records event for opening issueish in pane item:
Error: Trying to stub property 'open' of null
at throwOnFalsyObject (/Users/runner/work/1/s/node_modules/github/node_modules/sinon/lib/sinon/throw-on-falsy-object.js:7:15)
at Function.stub (/Users/runner/work/1/s/node_modules/github/node_modules/sinon/lib/sinon/stub.js:70:24)
at Sandbox.stub (/Users/runner/work/1/s/node_modules/github/node_modules/sinon/lib/sinon/sandbox.js:331:37)
at Context.<anonymous> (/Users/runner/work/1/s/node_modules/github/github-dotcom-markdown.test.js:167:13)
at processImmediate (internal/timers.js:439:21)
3) GithubDotcomMarkdown
opening issueish links
does not record event if opening issueish in pane item fails:
Error: Trying to stub property 'open' of null
at throwOnFalsyObject (/Users/runner/work/1/s/node_modules/github/node_modules/sinon/lib/sinon/throw-on-falsy-object.js:7:15)
at Function.stub (/Users/runner/work/1/s/node_modules/github/node_modules/sinon/lib/sinon/stub.js:70:24)
at Sandbox.stub (/Users/runner/work/1/s/node_modules/github/node_modules/sinon/lib/sinon/sandbox.js:331:37)
at Context.<anonymous> (/Users/runner/work/1/s/node_modules/github/github-dotcom-markdown.test.js:179:13)
at processImmediate (internal/timers.js:439:21)
4) WorkerManager
when the manager process is destroyed
destroys all the renderer processes that were created:
Error: Timeout of 60000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/runner/work/1/s/node_modules/github/test/worker-manager.test.js)