Skip to content

Commit 8e9950e

Browse files
authored
fix: optimize collection beforeEach hooks (#15198)
1 parent 41f842a commit 8e9950e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/jest-circus/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export const getEachHooksForTest = (test: Circus.TestEntry): TestHooks => {
161161
}
162162
// 'beforeEach' hooks are executed from top to bottom, the opposite of the
163163
// way we traversed it.
164-
result.beforeEach = [...beforeEachForCurrentBlock, ...result.beforeEach];
164+
result.beforeEach.unshift(...beforeEachForCurrentBlock);
165165
} while ((block = block.parent));
166166
return result;
167167
};

0 commit comments

Comments
 (0)