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

View File

@ -10,7 +10,7 @@ try
# Show window synchronously so a focusout doesn't fire on input elements
# 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.
exportsPath = path.join(atom.getLoadSettings().resourcePath, 'exports')
@ -22,12 +22,12 @@ try
testRunner = require('./jasmine-test-runner')
testRunner({
logFile: atom.getLoadSettings().logFile
exitWhenDone: atom.getLoadSettings().exitWhenDone
headless: atom.getLoadSettings().headless
testPaths: [atom.getLoadSettings().specDirectory]
})
catch error
if atom?.getLoadSettings().exitWhenDone
if atom?.getLoadSettings().headless
console.error(error.stack ? error)
atom.exit(1)
else

View File

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

View File

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