Skip to content

Instantly share code, notes, and snippets.

@gbelote
Created March 6, 2011 21:12
Show Gist options
  • Save gbelote/857673 to your computer and use it in GitHub Desktop.
Save gbelote/857673 to your computer and use it in GitHub Desktop.
Start a server on port 3000 with socket.io
var express = require('express');
var io = require('socket.io');
var app = express.createServer();
app.get('/', function(req, res){
res.send("<html><head><script src='/socket.io/socket.io.js'></script></head></html>");
});
app.listen(3000);
io.listen(app);
$ node zombie.test.js
Zombie: GET http://localhost:3000/
Zombie: GET http://localhost:3000/ => 200
Zombie: GET http://localhost:3000/socket.io/socket.io.js
Zombie: GET http://localhost:3000/socket.io/socket.io.js => 200
Zombie: Running script from /socket.io/socket.io.js
TypeError: Cannot set property 'io' of undefined
at /socket.io/socket.io.js:20:33
at DOMWindow._evaluate (/Users/gbelote/local/lib/node/.npm/zombie/0.9.4/package/lib/zombie/browser.js:90:24)
at Object.javascript (/Users/gbelote/local/lib/node/.npm/zombie/0.9.4/package/lib/zombie/jsdom_patches.js:63:21)
at Object._eval (/Users/gbelote/local/lib/node/.npm/jsdom/0.1.23/package/lib/jsdom/level2/html.js:1223:46)
at Object.<anonymous> (/Users/gbelote/local/lib/node/.npm/zombie/0.9.4/package/lib/zombie/jsdom_patches.js:41:27)
at /Users/gbelote/local/lib/node/.npm/jsdom/0.1.23/package/lib/jsdom/level2/html.js:49:20
at Object.check (/Users/gbelote/local/lib/node/.npm/zombie/0.9.4/package/lib/zombie/jsdom_patches.js:131:34)
at /Users/gbelote/local/lib/node/.npm/zombie/0.9.4/package/lib/zombie/jsdom_patches.js:149:19
at /Users/gbelote/local/lib/node/.npm/zombie/0.9.4/package/lib/zombie/resources.js:127:18
at Resources.<anonymous> (/Users/gbelote/local/lib/node/.npm/zombie/0.9.4/package/lib/zombie/resources.js:256:38)
var zombie = require('zombie');
zombie.visit('http://localhost:3000/', { debug: true }, function(err, browser) {
if( err ) {
console.log( err.stack );
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment