Closed IL55 closed 9 years ago
hey thanks so much for the test. I don't think that this is a realistic case, though an error is an error and i say we think about this together.
The whole point is to walk a directory potentially recursively and emit events for paths that exist. E_NOENT is something that doesn't exist. This error should never be emitted by something that is finding things. I'm not not finding things ;)
To create this case you would have to delete a file in between the readdir and the lstat. this can happen but it should not break the walk. it doesn't exist it shouldn't be found and is not an error.
What if i did not break and retry on errors related to the file system being too busy? this would be an error that i should at certainly fail for. My library cannot ensure its contract of finding all of the paths below target directory. Only after the contract is ensured (to make this library better) I would need to implement some polling for example while i wait for the fs to stop being busy and fail after configurable timeout or attempts.
if you want to pull request failing tests for such things i use "tap" as my test harness
Hi, I wrote small test which (I expect) should pass OK. The idea is to fail fs.lstat function, and 'error' callback should be called But I see next:
mocha ./specs Error: Uncaught, unspecified 'error' event.
var sinon = require('sinon'); var chai = require("chai"); var should = chai.Should(); var chaiAsPromised = require("chai-as-promised"); chai.use(chaiAsPromised); var walk = require('walkdir'); var fs = require('fs'); .....
it.only("Check walkdir", function (done) {
});