mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Enable integration tests with environment var
I think this makes more sense then running them via a separate command, since that command would only make sense for atom-core, unlike the current 'run-package-specs' command, which works for any atom package. This way, they won't run by default, but you can opt in to running them on the command line by setting an env var, or in the spec runner by temporarily editing the code, like we do for focused tests anyway.
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
# These tests are excluded by default. To run them from the command line:
|
||||
#
|
||||
# ATOM_INTEGRATION_TESTS_ENABLED=true apm test
|
||||
return unless process.env.ATOM_INTEGRATION_TESTS_ENABLED
|
||||
|
||||
os = require "os"
|
||||
fs = require "fs"
|
||||
path = require "path"
|
||||
@@ -12,18 +17,16 @@ SocketPath = path.join(os.tmpdir(), "atom-integration-test.sock")
|
||||
ChromeDriverPort = 9515
|
||||
|
||||
describe "Starting Atom", ->
|
||||
if spawnSync("which", ["chromedriver"]).status isnt 0
|
||||
console.log "Skipping integration tests because the `chromedriver` executable was not found."
|
||||
return
|
||||
|
||||
[chromeDriver, driver, tempDirPath] = []
|
||||
|
||||
beforeEach ->
|
||||
tempDirPath = temp.mkdirSync("empty-dir")
|
||||
chromeDriver = spawn "chromedriver", ["--verbose", "--port=#{ChromeDriverPort}"]
|
||||
|
||||
# Uncomment to see chromedriver debug output
|
||||
# chromeDriver.stderr.on "data", (d) -> console.log(d.toString())
|
||||
waitsFor "chromedriver to start", (done) ->
|
||||
chromeDriver = spawn "chromedriver", ["--verbose", "--port=#{ChromeDriverPort}"]
|
||||
chromeDriver.on "error", (error) ->
|
||||
throw new Error("chromedriver failed to start: #{error.message}")
|
||||
chromeDriver.stderr.on "data", -> done()
|
||||
|
||||
afterEach ->
|
||||
waitsForPromise -> driver.quit().thenFinally(-> chromeDriver.kill())
|
||||
|
||||
Reference in New Issue
Block a user