metro: switch Bundler-test to the new memory-fs

Reviewed By: rafeca

Differential Revision: D7111251

fbshipit-source-id: dfba2c3e7d17cc90c329785736b7c5a30816305b
This commit is contained in:
Jean Lauliac 2018-03-02 11:45:15 -08:00 committed by Facebook Github Bot
parent cc392c699a
commit a4d1bf21b3
1 changed files with 5 additions and 10 deletions

View File

@ -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(),