Skip to content

Commit

Permalink
Executing globalConfig only when there are tests available to be exec…
Browse files Browse the repository at this point in the history
…uted (#5323)
  • Loading branch information
anilreddykatta authored and cpojer committed Jan 15, 2018
1 parent dd848f3 commit 7743c09
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/jest-cli/src/run_jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ export default (async function runJest({
onComplete: (testResults: AggregatedResult) => any,
failedTestsCache: ?FailedTestsCache,
}) {
if (globalConfig.globalSetup) {
// $FlowFixMe
await require(globalConfig.globalSetup)();
}
const sequencer = new TestSequencer();
let allTests = [];

Expand Down Expand Up @@ -184,7 +180,10 @@ export default (async function runJest({
// original value of rootDir. Instead, use the {cwd: Path} property to resolve
// paths when printing.
setConfig(contexts, {cwd: process.cwd()});

if (globalConfig.globalSetup) {
// $FlowFixMe
await require(globalConfig.globalSetup)();
}
const results = await new TestScheduler(globalConfig, {
startRun,
}).scheduleTests(allTests, testWatcher);
Expand Down

0 comments on commit 7743c09

Please sign in to comment.