Skip to content

Commit

Permalink
fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Jan 14, 2019
1 parent 17d27b7 commit 4f86934
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/jest-runtime/src/__tests__/script_transformer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,11 @@ describe('ScriptTransformer', () => {
});

it('reads values from the cache', () => {
config = {...config, transform: [['^.+\\.js$', 'test_preprocessor']]};
let scriptTransformer = new ScriptTransformer(config);
const transformConfig = {
...config,
transform: [['^.+\\.js$', 'test_preprocessor']],
};
let scriptTransformer = new ScriptTransformer(transformConfig);
scriptTransformer.transform('/fruits/banana.js', {});

const cachePath = getCachePath(mockFs, config);
Expand All @@ -506,7 +509,7 @@ describe('ScriptTransformer', () => {

// Restore the cached fs
mockFs = mockFsCopy;
scriptTransformer = new ScriptTransformer(config);
scriptTransformer = new ScriptTransformer(transformConfig);
scriptTransformer.transform('/fruits/banana.js', {});

expect(fs.readFileSync.mock.calls.length).toBe(2);
Expand All @@ -518,8 +521,8 @@ describe('ScriptTransformer', () => {
jest.resetModuleRegistry();
reset();
mockFs = mockFsCopy;
config.cache = false;
scriptTransformer = new ScriptTransformer(config);
transformConfig.cache = false;
scriptTransformer = new ScriptTransformer(transformConfig);
scriptTransformer.transform('/fruits/banana.js', {});

expect(fs.readFileSync.mock.calls.length).toBe(1);
Expand Down

0 comments on commit 4f86934

Please sign in to comment.