How to BDD a Node.js app with websocket/socket.io client
The regular BDD options in Node.js do not work with websockets. There is a pretty easy hack which nobody seems to be talking about.
There are regular BDD solutions for Node.js - Zombie.js & PhantomJS are two popular approaches. Neither of it works if your Node.js app uses websockets ( Dont have stats but IMHO every Node.js app has websocket client talking to it for real-time communication).
In that case, there is neat hack by segregating HTML & JS, use jsdom Node.js module to import HTML & directly import the JS. It gets pretty easier to do BDD then. Pretty nifty hack.
Come to the session for a more hands-on session with an example app. Checkout a full-fledged app built using the same approach at http://github.com/pocha/terminal-codelearn
I am founder of Rails Tutorial site Codelearn, my 3rd venture. I was a PHP coder in my older avatar, Rails guy in current & would be embracing more of Node.js in future.
I have philosophy of less gyan & more work. The same is emulated on Codelearn & I try to keep things as succinct & to the point as possible in my talks as well.
- The first part of the story - http://www.codelearn.org/blog/sockjs-example-app-socketio-bdd-nodejs
- My writings - http://www.codelearn.org/blog/author/pocha