stream-mock icon indicating copy to clipboard operation
stream-mock copied to clipboard

[FEATURE] Error readable to mock error

Open daisy1754 opened this issue 4 years ago • 1 comments

Is your feature request related to a problem? Please describe. I have a program to read data from the stream. I want to write a test to cover the error path.

readStream.on("error", {
 // I want to run code here in my unit test
});

Describe the solution you'd like It would be nice if the library can provide ErrorReadble which I can pass error object

const mock = new ErrorReadble(new Error("mock error"));

daisy1754 avatar Jul 14 '20 00:07 daisy1754

Should not be difficult, let me try something when I found some time (probably this weekend). Feel free to open a PR in the meantime if you wish to contribute.

b4nst avatar Jul 16 '20 13:07 b4nst