16543fe8 by Adam Heath

Fix passing of mpConfig.base into jasmine requirejs callback function.

1 parent d03828e8
......@@ -407,7 +407,7 @@ module.exports = function (grunt) {
},
};
if (mpConfig.jasmine.withCoverage) {
templateOptions.requireConfig.callback = function() {
var instrumentationCallback = function instrumentationCallback(mpConfigBase) {
/* global requirejs:false */
var oldLoad = requirejs.load;
requirejs.load = function (context, moduleName, url) {
......@@ -431,13 +431,17 @@ module.exports = function (grunt) {
}
}
url = parts.join('/');
if (url.indexOf(mpConfig.base + '/scripts/') === 0) {
if (url.indexOf(mpConfigBase + '/scripts/') === 0) {
url = './.grunt/grunt-contrib-jasmine/' + url;
}
return oldLoad.apply(this, [context, moduleName, url]);
};
};
var stringify = require('node-stringify');
//templateOptions.requireConfig.callback = eval('(' + stringify(callbackBuilder) + ')(' + JSON.stringify(mpConfig.base) + ')');
templateOptions.requireConfig.callback = new Function(stringify(instrumentationCallback) + '(' + JSON.stringify(mpConfig.base) + ');');
templateOptions = {
coverage: 'dist/coverage/coverage.json',
report: 'dist/coverage',
......
......@@ -36,6 +36,7 @@
"jshint-stylish": "~0",
"load-grunt-tasks": "",
"lodash": "",
"node-stringify": "",
"punch": "~0.5.46",
"punch-html-fragment-content-parser": "^0.5.1"
},
......