首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Travis启动服务器并继续使用脚本

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

Stack Overflow用户
提问于 2016-12-20 13:04:11
回答 1查看 920关注 0票数 4

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

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

因此,问题是,如何在后台/新实例中运行服务器,使其不与此冲突?我确实用end_script来停止服务器,这样就不必终止它了。

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

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-12-20 16:14:59

您可以通过附加一个&来后台进程

代码语言:javascript
复制
before_script:
  - node ./test/server.js &
票数 10
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41243068

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档