Travis启动服务器并继续脚本

Dom*_*nik 3 unix travis-ci

对于我的测试,我需要一个输出样本/测试代码的虚拟服务器.我使用节点http服务器并在我的脚本之前启动它node ./test/server.js.

我可以启动它,但问题是它占用了实例,因此现在无法运行测试.

所以问题是,我怎样才能在后台/新实例中运行服务器,以免与它发生冲突?我使用end_script停止服务器,所以我不必终止它.

到目前为止这是我的travis-config:

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
Run Code Online (Sandbox Code Playgroud)

joe*_*epd 9

您可以通过附加以下内容来介绍该过程&:

before_script:
  - node ./test/server.js &
Run Code Online (Sandbox Code Playgroud)