Skip to content

Instantly share code, notes, and snippets.

@jcoglan
Created March 14, 2014 19:38
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jcoglan/9555182 to your computer and use it in GitHub Desktop.
var express = require("express"),
fs = require("fs"),
http = require("http"),
path = require("path")
var app = express()
app.use(express.static(path.resolve(__dirname, "public")))
app.get("/", function(request, response) {
response.send(fs.readFileSync("./index.html"))
})
module.exports = http.createServer(app)
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>zombie</title>
</head>
<body>
<ul></ul>
<script src="/jquery.js"></script>
<script>
try {
$("ul").prepend("<li>Hello</li>")
} catch (error) {
console.log(error.message)
}
</script>
</body>
</html>
{
"dependencies": {
"express": "~3.5.0",
"zombie": "~1.4.0"
}
}
var Browser = require("zombie"),
app = require("./app")
var server = app.listen(0, function() {
var origin = "http://localhost:" + server.address().port,
browser = new Browser()
browser.visit(origin + "/", function() {
console.log("Text:", browser.text("ul li:first-child"))
process.exit()
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment