I am trying to use moxios to mock the following scenario. axios.default.get(imageUrl, { responseType: 'stream' }) To unit test the above, I am trying to write jest with the following. moxios.stubRequest('http://abc.com/text.jpg', { status: 200, response: { data: fs.createReadStream(`${__dirname}/text.png`) } }); But the response.data. When I use response.data.pipe(somewriteablestream) it does not work. Any help appreciated for mocking a get request returning a stream object.