|
7 vuotta sitten | |
---|---|---|
.. | ||
examples | 7 vuotta sitten | |
test | 7 vuotta sitten | |
.npmignore | 7 vuotta sitten | |
.testem.json | 7 vuotta sitten | |
.travis.yml | 7 vuotta sitten | |
LICENCE | 7 vuotta sitten | |
README.md | 7 vuotta sitten | |
index.js | 7 vuotta sitten | |
package.json | 7 vuotta sitten |
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