Is it possible to mock, let's say, with the "mock-fs" library some sort of reading file errors? In particular, I want to test this case (where code !== 'ENOENT'):
fs.readFile(filePath, (err, data) => {
if (err) {
if (err.code !== 'ENOENT') {
return done(new ReadingFileError(filePath));
}
}
// ...
});
I could find nothing about emulating reading errors in their docs. Maybe there are some other libraries that can do this.