Permalink
Browse files

fix test server

  • Loading branch information...
1 parent a713911 commit 930d5be4d06081d454175ae7ea2ac29e8973c0cd @tj tj committed Jan 16, 2013
Showing with 31 additions and 28 deletions.
  1. +3 −3 package.json
  2. +7 −8 test/server.js
  3. +1 −1 test/views/layout.jade
  4. +20 −16 test/views/tests.jade
View
@@ -9,11 +9,11 @@
"test": "make test"
}
, "devDependencies": {
- "express": ">= 2.3.7 && < 3.0.0"
- , "jade": "0.11.0"
+ "express": "3.0"
+ , "jade": "0.28.1"
, "mocha": "*"
, "should": "*"
}
- , "engines": { "node": ">= 0.4.0" }
+ , "engines": { "node": ">= 0.6.0" }
, "main": "./lib/canvas.js"
}
View
@@ -6,12 +6,10 @@
var express = require('express')
, Canvas = require('../lib/canvas')
, Image = Canvas.Image
- , jade = require('jade')
- , app = express.createServer();
+ , app = express();
// Config
-app.register('.jade', jade);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
@@ -22,7 +20,7 @@ app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(app.router);
app.use(express.static(__dirname + '/public'));
-app.use(express.errorHandler({ showStack: true }));
+app.use(express.errorHandler());
// Routes
@@ -36,7 +34,7 @@ app.post('/render', function(req, res, next){
req.body.fn = req.body.fn
.replace("'state.png'", "'" + __dirname + "/public/state.png'")
.replace("'face.jpeg'", "'" + __dirname + "/public/face.jpeg'");
-
+
// Do not try this at home :)
var fn = eval('(' + req.body.fn + ')')
, width = req.body.width
@@ -52,10 +50,11 @@ app.post('/render', function(req, res, next){
});
}
- 2 == fn.length
+ 2 == fn.length
? fn(ctx, done)
: fn(ctx), done();
});
-app.listen(parseInt(process.argv[2] || '3000', 10));
-console.log('Test server listening on port %d', app.address().port);
+var port = parseInt(process.argv[2] || '4000', 10);
+app.listen(port);
+console.log('Test server listening on port %d', port);
View
@@ -6,4 +6,4 @@ html
script(src='/tests.js')
script(src='/app.js')
body
- #primary!= body
+ block content
View
@@ -1,19 +1,23 @@
-h1 node-canvas
-p.msg
- | The tests below assert visual and api integrity by running the
- em exact
- | same code utilizing the client canvas api, as well as node-canvas.
+extend layout
-p
- | Click to
- a#run(href='#') re-run
- | the test suite or "r".
+block content
+ h1 node-canvas
-table#tests
- thead
- tr
- th node-canvas
- th target
- th
- tbody
+ p.msg
+ | The tests below assert visual and api integrity by running the
+ em &nbsp;exact&nbsp;
+ | same code utilizing the client canvas api, as well as node-canvas.
+
+ p
+ | Click to
+ a#run(href='#') &nbsp;re-run&nbsp;
+ | the test suite or "r".
+
+ table#tests
+ thead
+ tr
+ th node-canvas
+ th target
+ th
+ tbody

0 comments on commit 930d5be

Please sign in to comment.