Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

throw when callback is not given to app.engine()

  • Loading branch information...
commit 67ca22b6e4b2daa68f385f39385bd9efcc6e979b 1 parent ba413ee
@tj tj authored
Showing with 9 additions and 1 deletion.
  1. +1 −0  lib/application.js
  2. +8 −1 test/app.engine.js
View
1  lib/application.js
@@ -206,6 +206,7 @@ app.use = function(route, fn){
*/
app.engine = function(ext, fn){
+ if ('function' != typeof fn) throw new Error('callback function required');
if ('.' != ext[0]) ext = '.' + ext;
this.engines[ext] = fn;
return this;
View
9 test/app.engine.js
@@ -25,7 +25,14 @@ describe('app', function(){
done();
})
})
-
+
+ it('should throw when the callback is missing', function(){
+ var app = express();
+ (function(){
+ app.engine('.html', null);
+ }).should.throw('callback function required');
+ })
+
it('should work without leading "."', function(done){
var app = express();
Please sign in to comment.
Something went wrong with that request. Please try again.