How do bring down a connect server in Grunt?

无人久伴 提交于 2019-12-22 12:07:57

问题


I'm running protractor tests on a connect server, since there is no built in web server as in karma. No problem with that, only karma shuts down its web server once it's done running the tests but there is no such mechanism in protractor.

I'd like to run protractor tests on a connect server and then spin up another connect server, potentially with a different configuration. So far I've managed to run another connect server on a different port but I still have the two connect servers running side by side and I'd like to close the one I used for testing.

Here is my connect config:

connect: {
  test: {
    options: {
      port: 8001,
    }
  },
  production: {
    options: {
      port: 8000,
      keepalive: true,
    }
  }
}

and my grunt tasks:

grunt.registerTask('default', ['jshint', 'karma:unit', 'clean', 'requirejs', 'concat', 'uglify', 'connect:test', 'protractor:e2e']);
grunt.registerTask('preview-live', ['default', 'connect:production']);

I've had a look at the keepalive option, rolling my own and even grunt events but I still can't figure out how to go about this.

来源:https://stackoverflow.com/questions/24064454/how-do-bring-down-a-connect-server-in-grunt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!