This regression was caused by a nuance in the way we maintain state in
`AtomApplication` for open windows. Specifically, when closing the last
window on Windows and Linux, we were explicitly calling `app.quit`
*before* removing such window from the list of open ones. In turn, this
caused the new `before-quit` behavior introduced in #12619 to work
improperly because it made the application wait on saving the state of a
stale window before exiting.
With this commit we are fixing that by making sure the stale window is
removed before calling `app.quit` in `removeWindow`.
Unless a choice has been made by the user, this tab always shows up as
the first one when opening Atom, thus breaking some of the assumptions
we make in the main process tests.
This, along with using a temporary directory as the ATOM_HOME, will make
sure that tests won't share any state with one another, possibly
increasing the level of resiliency of the suite.
...so that we can exercise loading previously opened windows stored
state after the application is restarted. In addition, this resembles
more what we run in production, and therefore allows us to have a better
coverage of the code paths we run in the real application.
It was testing something that didn’t actually work, that opening a
directory that was already open in an existing window would recycle the
window. We explicitly don’t behave that way and the old test was passing
spuriously.