eldargab / node-fake-fs

Fake node.js file system for testing
32 stars 5 forks source link

not compatible with `fs` #8

Closed Raynos closed 10 years ago

Raynos commented 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.

fake-fs depends on this.

Fix:

Add a bindAll() call to the constructor.

Raynos commented 10 years ago

@eldargab thanks :)