|
8 سال پیش | |
---|---|---|
.. | ||
examples | 8 سال پیش | |
test | 8 سال پیش | |
.npmignore | 8 سال پیش | |
.testem.json | 8 سال پیش | |
.travis.yml | 8 سال پیش | |
LICENCE | 8 سال پیش | |
README.md | 8 سال پیش | |
index.js | 8 سال پیش | |
package.json | 8 سال پیش |
Load a module with it's require's mocked out
Works in both node and browserify
var realB = require("./fixtures/b")
var b = mock("./fixtures/b", {
fs: {
readFileSync: function (uri) {
if (uri === "clowns.txt") {
return "some clowns"
}
}
}
, "./fixtures/c": null
, "./fixtures/a": function () {
return 42
}
}, require)
// use b. It's reference to fs and fixtures/a have been replaced with
// your passed objects
Limitations:
npm install mock