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$/;
|
||||
|
||||
// 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;
|
||||
|
||||
const path = require('path');
|
||||
|
@ -122,7 +127,6 @@ beforeEach(() => {
|
|||
|
||||
describe('DependencyGraph', function() {
|
||||
let Module;
|
||||
let extractDependencies;
|
||||
let defaults;
|
||||
|
||||
function getOrderedDependenciesAsJSON(dgraph, entryPath, platform, recursive = true) {
|
||||
|
@ -193,8 +197,6 @@ describe('DependencyGraph', function() {
|
|||
Cache.prototype.end = jest.genMockFn();
|
||||
|
||||
const transformCacheKey = 'abcdef';
|
||||
extractDependencies =
|
||||
require('../../JSTransformer/worker/extract-dependencies');
|
||||
defaults = {
|
||||
assetExts: ['png', 'jpg'],
|
||||
cache: new Cache(),
|
||||
|
@ -2744,7 +2746,6 @@ describe('DependencyGraph', function() {
|
|||
jest.resetModules();
|
||||
jest.mock('path', () => path.win32);
|
||||
DependencyGraph = require('../index');
|
||||
extractDependencies = require('../../JSTransformer/worker/extract-dependencies');
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
|
|
Loading…
Reference in New Issue