Closed failpunk closed 8 years ago
That is one approach, yes! For a more robust approach, see my gist: https://gist.github.com/devinivy/1e6e71abcb721fa8fee9
Your approach will work with one small change. To keep the testing suite in sync timing-wise, you should put that boilerplate Glue.compose()
code into a lab before()
call, as demonstrated here: https://github.com/hapijs/lab#usage
Thanks @devinivy, making it async and putting Glue.compose
in the before call works.
I'll have to take a bit more time to grok your more robust solution to see how I might use that.
Yeah, this stuff can be hard. Testing servers is a common pain-point. Feel free to ask questions here and for further topics on the hapijs/discuss repo!
If you're ever able to PR a good testing solution into this repo, I'd love that. The gist I sent above is a little more heavy-duty than I'd like to include in this boilerplate.
I'm new to node and I'm checking out your repo...thanks!! I have everything up and running but I can't see to get testing going.
I'm assuming that since your are exporting the manifest in
server.js
that you would create the server via Glue in each of your test files. Whenever I do this it never calls the callback passed toGlue.compose
Am I setting this up right?
Test Output:
0 tests complete Test duration: 0 ms No global variable leaks detected