Skip to content

Commit

Permalink
remove double loop
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Jan 18, 2019
1 parent 3169d00 commit 8629458
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/jest-cli/src/runGlobalHook.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ export default ({
return;
}

const projectConfig =
allTests
.map(t => t.context.config)
.find(c => c[moduleName] === modulePath) ||
// Fallback to first one
allTests[0].context.config;
const correctConfig = allTests.find(
t => t.context.config[moduleName] === modulePath,
);

const projectConfig = correctConfig
? correctConfig.context.config
: // Fallback to first config
allTests[0].context.config;

const transformer = new ScriptTransformer(projectConfig);

Expand Down

0 comments on commit 8629458

Please sign in to comment.