JSFoo 2013

All about being creative with JavaScript

Pocha

@pocha_codelearn

How to BDD a Node.js app with websocket/socket.io client

Submitted Jul 23, 2013

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.

Outline

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

Speaker bio

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.

Comments

{{ gettext('Login to leave a comment') }}

{{ gettext('Post a comment…') }}
{{ gettext('New comment') }}
{{ formTitle }}

{{ errorMsg }}

{{ gettext('No comments posted yet') }}

Hosted by

JSFoo is a forum for discussing UI engineering; fullstack development; web applications engineering, performance, security and design; accessibility; and latest developments in #JavaScript. Follow JSFoo on Twitter more