Make sure that write streams are closed

Reviewed By: jeanlauliac

Differential Revision: D4117716

fbshipit-source-id: c12f07c6a0e016ac14543878491a8b4160099e21
This commit is contained in:
David Aurelio 2016-11-03 13:27:09 -07:00 committed by Facebook Github Bot
parent 1ac86b2304
commit b184c45275
1 changed files with 3 additions and 0 deletions

View File

@ -265,12 +265,15 @@ fs.createWriteStream.mockImpl(file => {
}); });
writeStream.__file = file; writeStream.__file = file;
writeStream.__chunks = []; writeStream.__chunks = [];
writeStream.end = jest.fn(writeStream.end);
fs.createWriteStream.mock.returned.push(writeStream);
return writeStream; return writeStream;
} else { } else {
throw new Error('Cannot open file ' + file); throw new Error('Cannot open file ' + file);
} }
} }
}); });
fs.createWriteStream.mock.returned = [];
fs.__setMockFilesystem = (object) => (filesystem = object); fs.__setMockFilesystem = (object) => (filesystem = object);