diff --git a/spec/main-process/atom-application.test.js b/spec/main-process/atom-application.test.js index 56b415197..002a483d4 100644 --- a/spec/main-process/atom-application.test.js +++ b/spec/main-process/atom-application.test.js @@ -164,12 +164,12 @@ describe('AtomApplication', function () { it('restores windows when launched with a project path to open', async function () { await scenario.launch({app, pathsToOpen: ['a']}) - await scenario.assert('[a _] [b _] [c _]') + await scenario.assert('[b _] [c _] [a _]') }) it('restores windows when launched with a file path to open', async function () { await scenario.launch({app, pathsToOpen: ['a/1.md']}) - await scenario.assert('[b 1.md] [c _]') + await scenario.assert('[b _] [c 1.md]') }) it('collapses new paths into restored windows when appropriate', async function () { diff --git a/src/main-process/atom-application.js b/src/main-process/atom-application.js index 7878ce655..4224dba69 100644 --- a/src/main-process/atom-application.js +++ b/src/main-process/atom-application.js @@ -252,8 +252,7 @@ class AtomApplication extends EventEmitter { this.config.onDidChange('core.colorProfile', () => this.promptForRestart()) } - const optionsForWindowsToOpen = [] - + let optionsForWindowsToOpen = [] let shouldReopenPreviousWindows = false if (options.test || options.benchmark || options.benchmarkTest) { @@ -269,9 +268,7 @@ class AtomApplication extends EventEmitter { } if (shouldReopenPreviousWindows) { - for (const previousOptions of await this.loadPreviousWindowOptions()) { - optionsForWindowsToOpen.push(previousOptions) - } + optionsForWindowsToOpen = [...await this.loadPreviousWindowOptions(), ...optionsForWindowsToOpen] } if (optionsForWindowsToOpen.length === 0) {