atom / snippets

Atom snippets package
MIT License
205 stars 101 forks source link

Don't return an unresolved Promise on beforeEach() #290

Closed rafeca closed 5 years ago

rafeca commented 5 years ago

Description of the Change

The editor.update() method returns a Promise, which under some circumstances (on specs mostly) never gets resolved.

Because of CoffeeScript's implicit returns, this Promise was returned on the beforeEach() method of these tests.

Before https://github.com/atom/atom/pull/18917, any Promise that was returned by a spec method was just discarded, so this behaviour didn't cause any issue, but once we merge that PR this test is going to start failing because jasmine will wait indefinitely until the Promise is resolved.

Alternate Designs

Figure out why the Promise that gets returned by editor.update() never gets resolved. I've started investigating it and this only happens when this codepath gets executed.

The official tests for TextEditor seem to avoid awaiting for that Promise (e.g if we add an await in this line that test is going to fail), so I've left the proper investigation in a TODO comment.

Benefits

This unblocks merging https://github.com/atom/atom/pull/18917

Possible Drawbacks

N/A

Applicable Issues

N/A

rafeca commented 5 years ago

I'm gonna merge this without a review since it's a safe change and it unblocks https://github.com/atom/atom/pull/18917 🙃