Functions that aren't defined as top-level properties of args are not making through to the loaded module source. So for example, this works fine:
// another-require.js
require('something');
// index.js
require = require('really-need');
require('./another-require', {
args: {
require: function (name) {
console.log('no requires allowed');
}
}
});
// prints "no requires allowed"
... but this doesn't:
// stuff-with-lodash.js
console.log( _.yam );
_.filter();
// index.js
require = require('really-need');
require('./stuff-with-lodash', {
args: {
_: {
'yam': 678,
'filter': function () {
console.log('look! a fake lodash filter!');
}
}
}
});
// prints:
// 678
// _.filter is not a function
I already hacked together something that works using a dusty gist by @cowboy but I'm not in love with it.
Let me know if this is something you think worth looking into.
Functions that aren't defined as top-level properties of
args
are not making through to the loaded module source. So for example, this works fine:... but this doesn't:
I already hacked together something that works using a dusty gist by @cowboy but I'm not in love with it. Let me know if this is something you think worth looking into.