How do i test my express app with mocha?

前端 未结 5 511
被撕碎了的回忆
被撕碎了的回忆 2020-12-22 18:55

I\'ve just added shouldjs and mocha to my express app for testing, but I\'m wondering how to test my application. I would like to do it like this:

app = requ         


        
5条回答
  •  情书的邮戳
    2020-12-22 19:24

    mocha comes with before, beforeEach, after, and afterEach for bdd testing. In this case you should use before in your describe call.

    describe 'routes' ->
      before (done) ->
        app.listen(3000)
        app.on('connection', done)
    

提交回复
热议问题