对于我的测试,我需要一个虚拟服务器,它输出示例/测试代码。为此,我使用节点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发布于 2016-12-20 16:14:59
您可以通过附加一个&来后台进程
before_script:
- node ./test/server.js &https://stackoverflow.com/questions/41243068
复制相似问题