Unix Travis启动服务器并继续使用脚本

Unix Travis启动服务器并继续使用脚本,unix,travis-ci,Unix,Travis Ci,对于我的测试,我需要一个输出样本/测试代码的虚拟服务器。为此,我使用一个节点http服务器,并在脚本之前使用node./test/server.js启动它 我可以启动它,但问题是它正在占用实例,因此现在无法运行测试 所以问题是,如何在后台/新实例中运行服务器,使其不与此冲突?我确实使用end\u脚本停止了服务器,所以我不必终止它 这是迄今为止我的travis配置: language: node_js node_js: - "6.1" cache: directories: — n

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

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

所以问题是,如何在后台/新实例中运行服务器,使其不与此冲突?我确实使用end\u脚本停止了服务器,所以我不必终止它

这是迄今为止我的travis配置:

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

您可以通过附加
&
,对流程进行后台处理:

before_script:
  - node ./test/server.js &