Add preserveFocus flag to keep main process tests from stealing focus

This commit is contained in:
Ash Wilson 2019-04-18 21:10:41 -04:00
parent e782cea2bf
commit b1d6e42aa9
No known key found for this signature in database
GPG Key ID: 81B1DDB704F69D2A
2 changed files with 6 additions and 1 deletions

View File

@ -597,6 +597,7 @@ class LaunchScenario {
if (options.pathsToOpen) {
options.pathsToOpen = this.convertPaths(options.pathsToOpen)
}
options.preserveFocus = true
const window = await app.openWithOptions(options)
this.windows.add(window)
@ -719,6 +720,7 @@ class LaunchScenario {
const app = new AtomApplication({
resourcePath: path.resolve(__dirname, '../..'),
atomHomeDirPath: this.atomHome,
preserveFocus: true,
...options
})
this.sinon.stub(app, 'createWindow', loadSettings => new StubWindow(this.sinon, loadSettings, options))

View File

@ -292,10 +292,13 @@ class AtomApplication extends EventEmitter {
timeout,
clearWindowState,
addToLastWindow,
preserveFocus,
env
} = options
if (!preserveFocus) {
app.focus()
}
if (test) {
return this.runTests({