Fix passing of mpConfig.base into jasmine requirejs callback function.
Showing
2 changed files
with
7 additions
and
2 deletions
... | @@ -407,7 +407,7 @@ module.exports = function (grunt) { | ... | @@ -407,7 +407,7 @@ module.exports = function (grunt) { |
407 | }, | 407 | }, |
408 | }; | 408 | }; |
409 | if (mpConfig.jasmine.withCoverage) { | 409 | if (mpConfig.jasmine.withCoverage) { |
410 | templateOptions.requireConfig.callback = function() { | 410 | var instrumentationCallback = function instrumentationCallback(mpConfigBase) { |
411 | /* global requirejs:false */ | 411 | /* global requirejs:false */ |
412 | var oldLoad = requirejs.load; | 412 | var oldLoad = requirejs.load; |
413 | requirejs.load = function (context, moduleName, url) { | 413 | requirejs.load = function (context, moduleName, url) { |
... | @@ -431,13 +431,17 @@ module.exports = function (grunt) { | ... | @@ -431,13 +431,17 @@ module.exports = function (grunt) { |
431 | } | 431 | } |
432 | } | 432 | } |
433 | url = parts.join('/'); | 433 | url = parts.join('/'); |
434 | if (url.indexOf(mpConfig.base + '/scripts/') === 0) { | 434 | if (url.indexOf(mpConfigBase + '/scripts/') === 0) { |
435 | url = './.grunt/grunt-contrib-jasmine/' + url; | 435 | url = './.grunt/grunt-contrib-jasmine/' + url; |
436 | } | 436 | } |
437 | return oldLoad.apply(this, [context, moduleName, url]); | 437 | return oldLoad.apply(this, [context, moduleName, url]); |
438 | }; | 438 | }; |
439 | }; | 439 | }; |
440 | 440 | ||
441 | var stringify = require('node-stringify'); | ||
442 | //templateOptions.requireConfig.callback = eval('(' + stringify(callbackBuilder) + ')(' + JSON.stringify(mpConfig.base) + ')'); | ||
443 | templateOptions.requireConfig.callback = new Function(stringify(instrumentationCallback) + '(' + JSON.stringify(mpConfig.base) + ');'); | ||
444 | |||
441 | templateOptions = { | 445 | templateOptions = { |
442 | coverage: 'dist/coverage/coverage.json', | 446 | coverage: 'dist/coverage/coverage.json', |
443 | report: 'dist/coverage', | 447 | report: 'dist/coverage', | ... | ... |
... | @@ -36,6 +36,7 @@ | ... | @@ -36,6 +36,7 @@ |
36 | "jshint-stylish": "~0", | 36 | "jshint-stylish": "~0", |
37 | "load-grunt-tasks": "", | 37 | "load-grunt-tasks": "", |
38 | "lodash": "", | 38 | "lodash": "", |
39 | "node-stringify": "", | ||
39 | "punch": "~0.5.46", | 40 | "punch": "~0.5.46", |
40 | "punch-html-fragment-content-parser": "^0.5.1" | 41 | "punch-html-fragment-content-parser": "^0.5.1" |
41 | }, | 42 | }, | ... | ... |
-
Please register or sign in to post a comment