From e4d64309b71bd6a1c23a4a71fc7578351ad3ec0d Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Sun, 27 Sep 2015 20:53:41 -0600 Subject: [PATCH] Allow multiple test paths to be specified as command line arguments --- src/browser/atom-application.coffee | 16 +++++++++++----- src/initialize-test-window.coffee | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index ce2355aa6..9ac5ea8b9 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -87,7 +87,7 @@ class AtomApplication openWithOptions: ({pathsToOpen, executedFrom, urlsToOpen, test, pidToKillWhenClosed, devMode, safeMode, newWindow, specDirectory, logFile, profileStartup}) -> if test - @runSpecs({headless: true, @resourcePath, specDirectory, logFile}) + @runTests({headless: true, @resourcePath, executedFrom, specDirectory, pathsToOpen, 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(headless: false, resourcePath: @devResourcePath, safeMode: @focusedWindow()?.safeMode) + @on 'application:run-all-specs', -> @runTests(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, headless: false}) + @runTests({resourcePath: @devResourcePath, specDirectory: specDirectory, headless: false}) ipc.on 'command', (event, command) => @emit(command) @@ -489,7 +489,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. - runSpecs: ({headless, resourcePath, specDirectory, logFile, safeMode}) -> + runTests: ({headless, resourcePath, executedFrom, specDirectory, pathsToOpen, logFile, safeMode}) -> if resourcePath isnt @resourcePath and not fs.existsSync(resourcePath) resourcePath = @resourcePath @@ -498,10 +498,16 @@ class AtomApplication catch error windowInitializationScript = require.resolve(path.resolve(__dirname, '..', '..', 'src', 'initialize-test-window')) + testPaths = [] + testPaths.push(specDirectory) if specDirectory? + if pathsToOpen? + for pathToOpen in pathsToOpen + testPaths.push(path.resolve(executedFrom, fs.normalize(pathToOpen))) + isSpec = true devMode = true safeMode ?= false - new AtomWindow({windowInitializationScript, resourcePath, headless, isSpec, devMode, specDirectory, logFile, safeMode}) + new AtomWindow({windowInitializationScript, resourcePath, headless, isSpec, devMode, testPaths, logFile, safeMode}) locationForPathToOpen: (pathToOpen, executedFrom='') -> return {pathToOpen} unless pathToOpen diff --git a/src/initialize-test-window.coffee b/src/initialize-test-window.coffee index 77461667c..aa8e7f5d6 100644 --- a/src/initialize-test-window.coffee +++ b/src/initialize-test-window.coffee @@ -23,7 +23,7 @@ try testRunner({ logFile: atom.getLoadSettings().logFile headless: atom.getLoadSettings().headless - testPaths: [atom.getLoadSettings().specDirectory] + testPaths: atom.getLoadSettings().testPaths }) catch error