I am using grunt-contrib-jasmine
with grunt-template-jasmine-requirejs
to generate the template. It was all working fine on Node v0.12.14, but when I upgraded to Node v4.5.0, my specrunner file output is malformed. It has chunks of JavaScript in the output as well as HTML. Example chunk:
function (obj) {
obj || (obj = {});
var __t, __p = '', __j = Array.prototype.join;
function print() { __p += __j.call(arguments, '') }
with (obj) {
__p += '<!doctype html>\n<html>\n<head>\n <meta charset="utf-8">\n <title>Jasmine Spec Runner</title>\n\n ';
css.forEach(function(style){ ;
__p += '\n <link rel="stylesheet" type="text/css" href="' +
((__t = ( style )) == null ? '' : __t) +
'">\n ';
}) ;
__p += '\n\n ';
with (scripts) { ;
__p += '\n ';
[].concat(vendor).forEach(function(script){ ;
__p += '\n <script src="' +
((__t = ( script )) == null ? '' : __t) +
'"></script>\n ';
Here is the 'jasmine' section in my Gruntfile:
jasmine: {
test: {
options: {
vendor: ["src/libs/jquery.js"],
display: "short",
summary: true,
specs: ['test/test.js'],
styles: ['src/css/main.css'],
template: require('grunt-template-jasmine-requirejs'),
templateOptions: {
requireConfig: {
baseUrl: 'src/',
paths: {
"test": "../test",
"jquery-1.9": "jquery-1.9.1"
}
}
}
}
}
}
Has some 'templateOptions' for 'grunt-template-jasmine-requirejs' changed that I'm not aware of? Here are the versions I'm using:
grunt-template-jasmine-requirejs 0.2.3
grunt-contrib-requirejs 1.0.0
grunt-contrib-jasmine 1.0.3
Since updating to Grunt v1.0.1, the issue is with the package, grunt-template-jasmine-requirejs
, which is no longer maintained. It should handle the template differently: grunt.util._.template(source, context)
should be grunt.util._.template(source)(context)
. Also, the Lodash version it uses collided with our version of Lodash.
There is a fork here which fixes these issues: https://github.com/radum/grunt-template-jasmine-requirejs/tree/7ca7ad28b1bbb7a940de7a01710f62c5b0eb6a65
However, this fork still uses the now deprecated grunt.util._
, so it may need readdressing in future.