From e7d29b49cd691abf59aca4c6a91e385b342ab1d5 Mon Sep 17 00:00:00 2001 From: Artemy Tregubenko Date: Thu, 29 Oct 2015 17:23:53 +0100 Subject: [PATCH 1/2] Template error supressed when it's included inside {% if %}: a test case --- tests/compiler.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/compiler.js b/tests/compiler.js index 0c78ae2e..df3d402a 100644 --- a/tests/compiler.js +++ b/tests/compiler.js @@ -1165,6 +1165,20 @@ finish(done); }); + it('should throw an error when including a file that calls an undefined macro even inside {% if %} tag', function(done) { + render( + '{% if true %}{% include "undefined-macro.html" %}{% endif %}', + {}, + { noThrow: true }, + function(err, res) { + expect(res).to.be(undefined); + expect(err).to.match(/Unable to call `\w+`, which is undefined or falsey/); + } + ); + + finish(done); + }); + it('should throw an error when including a file that imports macro that calls an undefined macro', function(done) { render( '{% include "import-macro-call-undefined-macro.html" %}', From 89cbe6159ecbdae3baefff4ee05c9db9a2121131 Mon Sep 17 00:00:00 2001 From: oyyd Date: Mon, 11 Jan 2016 15:50:29 +0800 Subject: [PATCH 2/2] fix asyncif eating error --- src/compiler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler.js b/src/compiler.js index e0a05266..646a93fa 100644 --- a/src/compiler.js +++ b/src/compiler.js @@ -581,7 +581,7 @@ var Compiler = Object.extend({ compileIfAsync: function(node, frame) { this.emit('(function(cb) {'); this.compileIf(node, frame, true); - this.emit('})(function() {'); + this.emit('})(' + this.makeCallback()); this.addScopeLevel(); },