mirror of https://github.com/status-im/metro.git
packager: DependencyGraph-test: require extractDependencies only once
Reviewed By: davidaurelio Differential Revision: D4182071 fbshipit-source-id: 622cb3e011b67c2a7df0c6308fbcb7a9ea1ebb96
This commit is contained in:
parent
1afa045dea
commit
ece4a18d7c
|
@ -111,6 +111,11 @@ jest.mock('jest-haste-map/build/crawlers/node', () => {
|
||||||
|
|
||||||
const mocksPattern = /(?:[\\/]|^)__mocks__[\\/]([^\/]+)\.js$/;
|
const mocksPattern = /(?:[\\/]|^)__mocks__[\\/]([^\/]+)\.js$/;
|
||||||
|
|
||||||
|
// This doesn't have state, and it's huge (Babel) so it's much faster to
|
||||||
|
// require it only once.
|
||||||
|
const extractDependencies = require('../../JSTransformer/worker/extract-dependencies');
|
||||||
|
jest.mock('../../JSTransformer/worker/extract-dependencies', () => extractDependencies);
|
||||||
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
@ -122,7 +127,6 @@ beforeEach(() => {
|
||||||
|
|
||||||
describe('DependencyGraph', function() {
|
describe('DependencyGraph', function() {
|
||||||
let Module;
|
let Module;
|
||||||
let extractDependencies;
|
|
||||||
let defaults;
|
let defaults;
|
||||||
|
|
||||||
function getOrderedDependenciesAsJSON(dgraph, entryPath, platform, recursive = true) {
|
function getOrderedDependenciesAsJSON(dgraph, entryPath, platform, recursive = true) {
|
||||||
|
@ -193,8 +197,6 @@ describe('DependencyGraph', function() {
|
||||||
Cache.prototype.end = jest.genMockFn();
|
Cache.prototype.end = jest.genMockFn();
|
||||||
|
|
||||||
const transformCacheKey = 'abcdef';
|
const transformCacheKey = 'abcdef';
|
||||||
extractDependencies =
|
|
||||||
require('../../JSTransformer/worker/extract-dependencies');
|
|
||||||
defaults = {
|
defaults = {
|
||||||
assetExts: ['png', 'jpg'],
|
assetExts: ['png', 'jpg'],
|
||||||
cache: new Cache(),
|
cache: new Cache(),
|
||||||
|
@ -2744,7 +2746,6 @@ describe('DependencyGraph', function() {
|
||||||
jest.resetModules();
|
jest.resetModules();
|
||||||
jest.mock('path', () => path.win32);
|
jest.mock('path', () => path.win32);
|
||||||
DependencyGraph = require('../index');
|
DependencyGraph = require('../index');
|
||||||
extractDependencies = require('../../JSTransformer/worker/extract-dependencies');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function() {
|
afterEach(function() {
|
||||||
|
|
Loading…
Reference in New Issue