Default devMode to true ASAP if running Atom in test mode

Previously, we ran the window in devMode, but didn’t set devMode to true
early enough to compute the correct resource path. This caused errors
when attempting to load the bundled keymaps when running atom —test
without the —dev flag.
This commit is contained in:
Nathan Sobo
2015-10-17 10:39:26 -06:00
parent 2cb77aa4b9
commit abee4c1db4
2 changed files with 4 additions and 3 deletions

View File

@@ -91,7 +91,7 @@ class AtomApplication
openWithOptions: ({pathsToOpen, executedFrom, urlsToOpen, test, pidToKillWhenClosed, devMode, safeMode, newWindow, logFile, profileStartup, timeout}) ->
if test
@runTests({headless: true, @resourcePath, executedFrom, pathsToOpen, logFile, timeout})
@runTests({headless: true, devMode, @resourcePath, executedFrom, pathsToOpen, logFile, timeout})
else if pathsToOpen.length > 0
@openPaths({pathsToOpen, executedFrom, pidToKillWhenClosed, newWindow, devMode, safeMode, profileStartup})
else if urlsToOpen.length > 0
@@ -494,7 +494,7 @@ class AtomApplication
# :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.
runTests: ({headless, resourcePath, executedFrom, pathsToOpen, logFile, safeMode, timeout}) ->
runTests: ({headless, devMode, resourcePath, executedFrom, pathsToOpen, logFile, safeMode, timeout}) ->
if resourcePath isnt @resourcePath and not fs.existsSync(resourcePath)
resourcePath = @resourcePath
@@ -522,7 +522,6 @@ class AtomApplication
legacyTestRunnerPath = @resolveLegacyTestRunnerPath()
testRunnerPath = @resolveTestRunnerPath(testPaths[0])
isSpec = true
devMode = true
safeMode ?= false
new AtomWindow({windowInitializationScript, resourcePath, headless, isSpec, devMode, testRunnerPath, legacyTestRunnerPath, testPaths, logFile, safeMode})

View File

@@ -133,6 +133,8 @@ parseCommandLine = ->
if args['resource-path']
devMode = true
resourcePath = args['resource-path']
devMode = true if test
resourcePath ?= devResourcePath if devMode
unless fs.statSyncNoException(resourcePath)