Closed Raynos closed 10 years ago
var globalFs = require('fs') function someCode(opts) { var fs = opts.fs || globalFs; var readFile = fs.readFile; readFile(someFile, function () { /* do stuff */ }) }
node's fs module does not have the functions in fs depend on the this value.
fs
this
fake-fs depends on this.
fake-fs
Add a bindAll() call to the constructor.
bindAll()
@eldargab thanks :)
node's
fs
module does not have the functions infs
depend on thethis
value.fake-fs
depends onthis
.Fix:
Add a
bindAll()
call to the constructor.