Skip to content

Commit 7743c09

Browse files
anilreddykattacpojer
authored andcommitted
Executing globalConfig only when there are tests available to be executed (#5323)
1 parent dd848f3 commit 7743c09

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

packages/jest-cli/src/run_jest.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,6 @@ export default (async function runJest({
9595
onComplete: (testResults: AggregatedResult) => any,
9696
failedTestsCache: ?FailedTestsCache,
9797
}) {
98-
if (globalConfig.globalSetup) {
99-
// $FlowFixMe
100-
await require(globalConfig.globalSetup)();
101-
}
10298
const sequencer = new TestSequencer();
10399
let allTests = [];
104100

@@ -184,7 +180,10 @@ export default (async function runJest({
184180
// original value of rootDir. Instead, use the {cwd: Path} property to resolve
185181
// paths when printing.
186182
setConfig(contexts, {cwd: process.cwd()});
187-
183+
if (globalConfig.globalSetup) {
184+
// $FlowFixMe
185+
await require(globalConfig.globalSetup)();
186+
}
188187
const results = await new TestScheduler(globalConfig, {
189188
startRun,
190189
}).scheduleTests(allTests, testWatcher);

0 commit comments

Comments
 (0)