From b184c45275e7615a275fec3902830d5e49426487 Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Thu, 3 Nov 2016 13:27:09 -0700 Subject: [PATCH] Make sure that write streams are closed Reviewed By: jeanlauliac Differential Revision: D4117716 fbshipit-source-id: c12f07c6a0e016ac14543878491a8b4160099e21 --- react-packager/src/node-haste/__mocks__/graceful-fs.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/react-packager/src/node-haste/__mocks__/graceful-fs.js b/react-packager/src/node-haste/__mocks__/graceful-fs.js index e67e63be..105d4cf0 100644 --- a/react-packager/src/node-haste/__mocks__/graceful-fs.js +++ b/react-packager/src/node-haste/__mocks__/graceful-fs.js @@ -265,12 +265,15 @@ fs.createWriteStream.mockImpl(file => { }); writeStream.__file = file; writeStream.__chunks = []; + writeStream.end = jest.fn(writeStream.end); + fs.createWriteStream.mock.returned.push(writeStream); return writeStream; } else { throw new Error('Cannot open file ' + file); } } }); +fs.createWriteStream.mock.returned = []; fs.__setMockFilesystem = (object) => (filesystem = object);