Rename exitWhenDone to headless

This commit is contained in:
Nathan Sobo 2015-09-25 15:49:57 -06:00
parent 2600115ebe
commit 8e988e874e
4 changed files with 15 additions and 15 deletions

View File

@ -3,7 +3,7 @@ _ = require 'underscore-plus'
fs = require 'fs-plus' fs = require 'fs-plus'
path = require 'path' path = require 'path'
module.exports = ({logFile, exitWhenDone, testPaths}) -> module.exports = ({logFile, headless, testPaths}) ->
window[key] = value for key, value of require '../vendor/jasmine' window[key] = value for key, value of require '../vendor/jasmine'
require 'jasmine-tagged' require 'jasmine-tagged'
@ -14,7 +14,7 @@ module.exports = ({logFile, exitWhenDone, testPaths}) ->
setSpecType('user') setSpecType('user')
jasmineEnv = jasmine.getEnv() jasmineEnv = jasmine.getEnv()
jasmineEnv.addReporter(buildReporter({logFile, exitWhenDone})) jasmineEnv.addReporter(buildReporter({logFile, headless}))
TimeReporter = require './time-reporter' TimeReporter = require './time-reporter'
jasmineEnv.addReporter(new TimeReporter()) jasmineEnv.addReporter(new TimeReporter())
jasmineEnv.setIncludedTags([process.platform]) jasmineEnv.setIncludedTags([process.platform])
@ -51,8 +51,8 @@ setSpecType = (specType) ->
setSpecDirectory = (specDirectory) -> setSpecDirectory = (specDirectory) ->
setSpecField('specDirectory', specDirectory) setSpecField('specDirectory', specDirectory)
buildReporter = ({logFile, exitWhenDone}) -> buildReporter = ({logFile, headless}) ->
if exitWhenDone if headless
buildTerminalReporter(logFile) buildTerminalReporter(logFile)
else else
AtomReporter = require './atom-reporter' AtomReporter = require './atom-reporter'

View File

@ -10,7 +10,7 @@ try
# Show window synchronously so a focusout doesn't fire on input elements # Show window synchronously so a focusout doesn't fire on input elements
# that are focused in the very first spec run. # that are focused in the very first spec run.
atom.getCurrentWindow().show() unless atom.getLoadSettings().exitWhenDone atom.getCurrentWindow().show() unless atom.getLoadSettings().headless
# Add 'exports' to module search path. # Add 'exports' to module search path.
exportsPath = path.join(atom.getLoadSettings().resourcePath, 'exports') exportsPath = path.join(atom.getLoadSettings().resourcePath, 'exports')
@ -22,12 +22,12 @@ try
testRunner = require('./jasmine-test-runner') testRunner = require('./jasmine-test-runner')
testRunner({ testRunner({
logFile: atom.getLoadSettings().logFile logFile: atom.getLoadSettings().logFile
exitWhenDone: atom.getLoadSettings().exitWhenDone headless: atom.getLoadSettings().headless
testPaths: [atom.getLoadSettings().specDirectory] testPaths: [atom.getLoadSettings().specDirectory]
}) })
catch error catch error
if atom?.getLoadSettings().exitWhenDone if atom?.getLoadSettings().headless
console.error(error.stack ? error) console.error(error.stack ? error)
atom.exit(1) atom.exit(1)
else else

View File

@ -87,7 +87,7 @@ class AtomApplication
openWithOptions: ({pathsToOpen, executedFrom, urlsToOpen, test, pidToKillWhenClosed, devMode, safeMode, newWindow, specDirectory, logFile, profileStartup}) -> openWithOptions: ({pathsToOpen, executedFrom, urlsToOpen, test, pidToKillWhenClosed, devMode, safeMode, newWindow, specDirectory, logFile, profileStartup}) ->
if test if test
@runSpecs({exitWhenDone: true, @resourcePath, specDirectory, logFile}) @runSpecs({headless: true, @resourcePath, specDirectory, logFile})
else if pathsToOpen.length > 0 else if pathsToOpen.length > 0
@openPaths({pathsToOpen, executedFrom, pidToKillWhenClosed, newWindow, devMode, safeMode, profileStartup}) @openPaths({pathsToOpen, executedFrom, pidToKillWhenClosed, newWindow, devMode, safeMode, profileStartup})
else if urlsToOpen.length > 0 else if urlsToOpen.length > 0
@ -160,7 +160,7 @@ class AtomApplication
devMode: @focusedWindow()?.devMode devMode: @focusedWindow()?.devMode
safeMode: @focusedWindow()?.safeMode safeMode: @focusedWindow()?.safeMode
@on 'application:run-all-specs', -> @runSpecs(exitWhenDone: false, resourcePath: @devResourcePath, safeMode: @focusedWindow()?.safeMode) @on 'application:run-all-specs', -> @runSpecs(headless: false, resourcePath: @devResourcePath, safeMode: @focusedWindow()?.safeMode)
@on 'application:quit', -> app.quit() @on 'application:quit', -> app.quit()
@on 'application:new-window', -> @openPath(_.extend(windowDimensions: @focusedWindow()?.getDimensions(), getLoadSettings())) @on 'application:new-window', -> @openPath(_.extend(windowDimensions: @focusedWindow()?.getDimensions(), getLoadSettings()))
@on 'application:new-file', -> (@focusedWindow() ? this).openPath() @on 'application:new-file', -> (@focusedWindow() ? this).openPath()
@ -251,7 +251,7 @@ class AtomApplication
@applicationMenu.update(win, template, keystrokesByCommand) @applicationMenu.update(win, template, keystrokesByCommand)
ipc.on 'run-package-specs', (event, specDirectory) => ipc.on 'run-package-specs', (event, specDirectory) =>
@runSpecs({resourcePath: @devResourcePath, specDirectory: specDirectory, exitWhenDone: false}) @runSpecs({resourcePath: @devResourcePath, specDirectory: specDirectory, headless: false})
ipc.on 'command', (event, command) => ipc.on 'command', (event, command) =>
@emit(command) @emit(command)
@ -483,13 +483,13 @@ class AtomApplication
# Opens up a new {AtomWindow} to run specs within. # Opens up a new {AtomWindow} to run specs within.
# #
# options - # options -
# :exitWhenDone - A Boolean that, if true, will close the window upon # :headless - A Boolean that, if true, will close the window upon
# completion. # completion.
# :resourcePath - The path to include specs from. # :resourcePath - The path to include specs from.
# :specPath - The directory to load specs from. # :specPath - The directory to load specs from.
# :safeMode - A Boolean that, if true, won't run specs from ~/.atom/packages # :safeMode - A Boolean that, if true, won't run specs from ~/.atom/packages
# and ~/.atom/dev/packages, defaults to false. # and ~/.atom/dev/packages, defaults to false.
runSpecs: ({exitWhenDone, resourcePath, specDirectory, logFile, safeMode}) -> runSpecs: ({headless, resourcePath, specDirectory, logFile, safeMode}) ->
if resourcePath isnt @resourcePath and not fs.existsSync(resourcePath) if resourcePath isnt @resourcePath and not fs.existsSync(resourcePath)
resourcePath = @resourcePath resourcePath = @resourcePath
@ -501,7 +501,7 @@ class AtomApplication
isSpec = true isSpec = true
devMode = true devMode = true
safeMode ?= false safeMode ?= false
new AtomWindow({bootstrapScript, resourcePath, exitWhenDone, isSpec, devMode, specDirectory, logFile, safeMode}) new AtomWindow({bootstrapScript, resourcePath, headless, isSpec, devMode, specDirectory, logFile, safeMode})
locationForPathToOpen: (pathToOpen, executedFrom='') -> locationForPathToOpen: (pathToOpen, executedFrom='') ->
return {pathToOpen} unless pathToOpen return {pathToOpen} unless pathToOpen

View File

@ -19,7 +19,7 @@ class AtomWindow
isSpec: null isSpec: null
constructor: (settings={}) -> constructor: (settings={}) ->
{@resourcePath, pathToOpen, locationsToOpen, @isSpec, @exitWhenDone, @safeMode, @devMode} = settings {@resourcePath, pathToOpen, locationsToOpen, @isSpec, @headless, @safeMode, @devMode} = settings
locationsToOpen ?= [{pathToOpen}] if pathToOpen locationsToOpen ?= [{pathToOpen}] if pathToOpen
locationsToOpen ?= [] locationsToOpen ?= []
@ -131,7 +131,7 @@ class AtomWindow
@browserWindow.destroy() if chosen is 0 @browserWindow.destroy() if chosen is 0
@browserWindow.webContents.on 'crashed', => @browserWindow.webContents.on 'crashed', =>
global.atomApplication.exit(100) if @exitWhenDone global.atomApplication.exit(100) if @headless
chosen = dialog.showMessageBox @browserWindow, chosen = dialog.showMessageBox @browserWindow,
type: 'warning' type: 'warning'