在Travis CI中停止节点服务器

时间:2017-06-29 16:45:21

标签: node.js travis-ci

因此,我的代码包含需要服务器的单元测试。所以我已经切断并运行,我的测试通过,但问题是我不知道如何停止服务器,因此我的构建失败,因为它超时了。

这是我的配置文件

language: node_js
node_js:
 - "7.10.0"
services:
 - mongodb
env:
 - PORT=6655 IP="localhost" NODE_ENV="test"
script: 
 - npm start &
 - sleep 25
 - npm test

现在,我该如何停止节点服务器?

编辑:以下是我的npm脚本

  "scripts": {
    "build-js": "webpack --config webpack.config.js",
    "test": "node node_modules/.bin/mocha ./server/test  --require ./server/test/testHelper.js --watch  --reporter spec --timeout 10000 --compilers js:babel-core/register",
    "start": "npm run build-js && babel-node app.js myApp --presets es2015,stage-2 && nodemon --watch cms/client",
  }

0 个答案:

没有答案
相关问题