From a4d1bf21b3e8511396c846e8438f7b5746aaeeaf Mon Sep 17 00:00:00 2001 From: Jean Lauliac Date: Fri, 2 Mar 2018 11:45:15 -0800 Subject: [PATCH] metro: switch Bundler-test to the new memory-fs Reviewed By: rafeca Differential Revision: D7111251 fbshipit-source-id: dfba2c3e7d17cc90c329785736b7c5a30816305b --- .../metro/src/Bundler/__tests__/Bundler-test.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/packages/metro/src/Bundler/__tests__/Bundler-test.js b/packages/metro/src/Bundler/__tests__/Bundler-test.js index 9fb89293..96550038 100644 --- a/packages/metro/src/Bundler/__tests__/Bundler-test.js +++ b/packages/metro/src/Bundler/__tests__/Bundler-test.js @@ -14,7 +14,7 @@ jest .setMock('jest-worker', () => ({})) .setMock('metro-minify-uglify') .mock('image-size') - .mock('fs') + .mock('fs', () => new (require('metro-memory-fs'))()) .mock('os') .mock('assert') .mock('progress') @@ -29,6 +29,7 @@ var sizeOf = require('image-size'); var fs = require('fs'); const os = require('os'); const path = require('path'); +const mkdirp = require('mkdirp'); var commonOptions = { allowBundleUpdates: false, @@ -60,15 +61,9 @@ describe('Bundler', function() { projectRoots = ['/root']; - fs.__setMockFilesystem({ - path: {to: {'transformer.js': ''}}, - }); - - fs.statSync.mockImplementation(function() { - return { - isDirectory: () => true, - }; - }); + mkdirp.sync('/path/to'); + mkdirp.sync('/root'); + fs.writeFileSync('/path/to/transformer.js', ''); assetServer = { getAssetData: jest.fn(),