From 0f3f7daa4f08bac1955277cc54208455b50bd655 Mon Sep 17 00:00:00 2001 From: Miguel Jimenez Esun Date: Wed, 21 Feb 2018 04:52:32 -0800 Subject: [PATCH] Move mocking inside beforeEach for Transformer test Reviewed By: rafeca Differential Revision: D7040798 fbshipit-source-id: eece8c42e1368ead476c6d1495dad7e0abb4b0e3 --- .../src/JSTransformer/__tests__/Transformer-test.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/metro/src/JSTransformer/__tests__/Transformer-test.js b/packages/metro/src/JSTransformer/__tests__/Transformer-test.js index 30898622..a848c424 100644 --- a/packages/metro/src/JSTransformer/__tests__/Transformer-test.js +++ b/packages/metro/src/JSTransformer/__tests__/Transformer-test.js @@ -9,11 +9,6 @@ */ 'use strict'; -jest - .mock('fs', () => ({writeFileSync: jest.fn()})) - .mock('temp', () => ({path: () => '/arbitrary/path'})) - .mock('jest-worker', () => ({__esModule: true, default: jest.fn()})); - const Transformer = require('../'); const defaults = require('../../defaults'); @@ -36,7 +31,11 @@ describe('Transformer', function() { }; beforeEach(function() { - jest.resetModules(); + jest + .resetModules() + .mock('fs', () => ({writeFileSync: jest.fn()})) + .mock('temp', () => ({path: () => '/arbitrary/path'})) + .mock('jest-worker', () => ({__esModule: true, default: jest.fn()})); Cache = jest.fn(); Cache.prototype.get = jest.fn((a, b, c) => c());