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('jest-worker', () => ({}))
.setMock('metro-minify-uglify') .setMock('metro-minify-uglify')
.mock('image-size') .mock('image-size')
.mock('fs') .mock('fs', () => new (require('metro-memory-fs'))())
.mock('os') .mock('os')
.mock('assert') .mock('assert')
.mock('progress') .mock('progress')
@ -29,6 +29,7 @@ var sizeOf = require('image-size');
var fs = require('fs'); var fs = require('fs');
const os = require('os'); const os = require('os');
const path = require('path'); const path = require('path');
const mkdirp = require('mkdirp');
var commonOptions = { var commonOptions = {
allowBundleUpdates: false, allowBundleUpdates: false,
@ -60,15 +61,9 @@ describe('Bundler', function() {
projectRoots = ['/root']; projectRoots = ['/root'];
fs.__setMockFilesystem({ mkdirp.sync('/path/to');
path: {to: {'transformer.js': ''}}, mkdirp.sync('/root');
}); fs.writeFileSync('/path/to/transformer.js', '');
fs.statSync.mockImplementation(function() {
return {
isDirectory: () => true,
};
});
assetServer = { assetServer = {
getAssetData: jest.fn(), getAssetData: jest.fn(),