Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Travis start server and continue with scripts

Tags:

unix

travis-ci

for my tests I need a dummy server which outputs sample/test code. I use a node http server for that and start it before my scripts with node ./test/server.js.

I can start it, but the issue is that it's taking up the instance and therefore can't run the tests now.

So the question is, how can I run the server in the background/new instance so it doesn't conflict with that? I do stop the server with the end_script so I don't have to terminate it.

This is my travis-config so far:

language: node_js
node_js:
  - "6.1"
cache:
  directories:
    — node_modules
install:
  - npm install
before_script:
  - sh -e node ./test/server.js
script:
  - ./node_modules/mocha-phantomjs/bin/mocha-phantomjs ./test/browser/jelly.html
  - ./node_modules/mocha-phantomjs/bin/mocha-phantomjs ./test/browser/form.html
  - ./node_modules/mocha/bin/mocha ./test/node/jelly.js
after_script:
  - curl http://localhost:5555/close
like image 657
Dominik Avatar asked Dec 24 '22 22:12

Dominik


1 Answers

You can background the process by appending a &:

before_script:
  - node ./test/server.js &
like image 181
joepd Avatar answered Dec 27 '22 08:12

joepd