Here is a function from jasmine 2.0.0 standalone project:
function getJasmineRequireObj() {
if (typeof module !== "undefined" && module.exports) {
return exports;
} else {
window.jasmineRequire = window.jasmineRequire || {};
return window.jasmineRequire;
}
}
I guess that if I would use the standard require method the module property will be define. When I load this file using the VM module as follows the module global property is undefined:
var fs = require('fs');
var vm = require('vm');
var jasmineFile = fs.readFileSync(__dirname + '/jasmine.js');
vm.runInThisContext(src, jasmineFile);
Is this the expected behavior of the VM module or a defect?