mirror of https://github.com/status-im/metro.git
metro: DeltaBundler-test: use memory-fs
Reviewed By: rafeca Differential Revision: D7098504 fbshipit-source-id: 5c2c7b88b2a9b41f3c7d75613c7ab290622176ea
This commit is contained in:
parent
2b32b08b13
commit
a66a231dfc
|
@ -10,7 +10,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
jest
|
jest
|
||||||
.mock('fs')
|
.mock('fs', () => new (require('metro-memory-fs'))())
|
||||||
.mock('assert')
|
.mock('assert')
|
||||||
.mock('progress')
|
.mock('progress')
|
||||||
.mock('../DeltaCalculator')
|
.mock('../DeltaCalculator')
|
||||||
|
@ -20,6 +20,7 @@ jest
|
||||||
.mock('/path/to/transformer.js', () => ({}), {virtual: true});
|
.mock('/path/to/transformer.js', () => ({}), {virtual: true});
|
||||||
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const mkdirp = require('mkdirp');
|
||||||
|
|
||||||
const Bundler = require('../../Bundler');
|
const Bundler = require('../../Bundler');
|
||||||
const DeltaTransformer = require('../DeltaTransformer');
|
const DeltaTransformer = require('../DeltaTransformer');
|
||||||
|
@ -53,16 +54,10 @@ describe('DeltaTransformer', () => {
|
||||||
.fn()
|
.fn()
|
||||||
.mockImplementation(opts => Promise.resolve(new DependencyGraph(opts)));
|
.mockImplementation(opts => Promise.resolve(new DependencyGraph(opts)));
|
||||||
|
|
||||||
fs.__setMockFilesystem({
|
mkdirp.sync('/path/to');
|
||||||
path: {to: {'transformer.js': ''}},
|
fs.writeFileSync('/path/to/transformer.js', '');
|
||||||
root: {to: {'something.js': ''}},
|
mkdirp.sync('/root/to');
|
||||||
});
|
fs.writeFileSync('/root/to/something.js', '');
|
||||||
|
|
||||||
fs.statSync.mockImplementation(function() {
|
|
||||||
return {
|
|
||||||
isDirectory: () => true,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
bundler = new Bundler(bundlerOptions);
|
bundler = new Bundler(bundlerOptions);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue