node tests: Avoid re-compiling templates.

This is a minor optimization to avoid re-compiling templates
that have already encountered.
This commit is contained in:
Steve Howell 2016-11-04 08:14:48 -07:00 committed by Tim Abbott
parent dd4a8eeebd
commit 0085164ad9
1 changed files with 5 additions and 0 deletions

View File

@ -40,6 +40,11 @@ exports.use_template = function (name) {
Handlebars.templates = {};
}
if (_.has(Handlebars.template, name)) {
// we already compile the template
return;
}
var flag = false,
counter = 0,
data;