metro: DeltaBundler-test: use memory-fs

Reviewed By: rafeca

Differential Revision: D7098504

fbshipit-source-id: 5c2c7b88b2a9b41f3c7d75613c7ab290622176ea
This commit is contained in:
Jean Lauliac 2018-02-28 02:28:15 -08:00 committed by Facebook Github Bot
parent 2b32b08b13
commit a66a231dfc
1 changed files with 6 additions and 11 deletions

View File

@ -10,7 +10,7 @@
'use strict';
jest
.mock('fs')
.mock('fs', () => new (require('metro-memory-fs'))())
.mock('assert')
.mock('progress')
.mock('../DeltaCalculator')
@ -20,6 +20,7 @@ jest
.mock('/path/to/transformer.js', () => ({}), {virtual: true});
const fs = require('fs');
const mkdirp = require('mkdirp');
const Bundler = require('../../Bundler');
const DeltaTransformer = require('../DeltaTransformer');
@ -53,16 +54,10 @@ describe('DeltaTransformer', () => {
.fn()
.mockImplementation(opts => Promise.resolve(new DependencyGraph(opts)));
fs.__setMockFilesystem({
path: {to: {'transformer.js': ''}},
root: {to: {'something.js': ''}},
});
fs.statSync.mockImplementation(function() {
return {
isDirectory: () => true,
};
});
mkdirp.sync('/path/to');
fs.writeFileSync('/path/to/transformer.js', '');
mkdirp.sync('/root/to');
fs.writeFileSync('/root/to/something.js', '');
bundler = new Bundler(bundlerOptions);
});