# Code coverage report for spec/env/node.js

## Statements: 36.36% (4 / 11) Branches: 100% (0 / 0) Functions: 0% (0 / 3) Lines: 36.36% (4 / 11) Ignored: none

All files » spec/env/ » node.js

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    1

    1

    1

    1

     /*global handlebarsEnv */
    require('./common');

    global.Handlebars = require('../../lib');

    global.CompilerContext = {
      compile: function(template, options) {
        var templateSpec = handlebarsEnv.precompile(template, options);
        return handlebarsEnv.template(safeEval(templateSpec));
      },
      compileWithPartial: function(template, options) {
        return handlebarsEnv.compile(template, options);
      }
    };

    function safeEval(templateSpec) {
      try {
        return eval('(' + templateSpec + ')');
      } catch (err) {
        console.error(templateSpec);
        throw err;
      }
    }