Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update integration test helper #44

Open
craigspaeth opened this issue Oct 1, 2014 · 0 comments
Open

Update integration test helper #44

craigspaeth opened this issue Oct 1, 2014 · 0 comments

Comments

@craigspaeth
Copy link
Contributor

It could be simpler and more helpful using a .env.test file and child.stdout.pipe process.stdout

e.g.

spawn = require("child_process").spawn
express = require "express"

# Stubbed API
@api = express()

# Spawns a child process with test .env.test variables
@startServer = (callback) =>
  return callback() if @child?
  @child = spawn "make", ["test-s"],
    customFds: [0, 1, 2]
    stdio: ["ipc"]
  @child.on "message", -> callback()
  @child.stdout.pipe process.stdout

# Closes the server child process, used in an `after` hook and on
# `process.exit` in case the test suite is interupted.
@closeServer = =>
  @child?.kill()
  @child = null

process.on "exit", @closeServer
@craigspaeth craigspaeth changed the title Update integration helper Update integration test helper Oct 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant