Skip to content

Commit

Permalink
fix(treeProcessor): revert a small change from the #5585 refactoring (#…
Browse files Browse the repository at this point in the history
…6006)

fixes #5964
moves the `wrapChildren` into higher scope to restore undocumented execution order
  • Loading branch information
niieani authored and cpojer committed Apr 17, 2018
1 parent a6d26b4 commit bf654e1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/jest-jasmine2/src/tree_processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,16 @@ export default function treeProcessor(options: Options) {
}

function getNodeWithChildrenHandler(node: TreeNode, enabled: boolean) {
// NOTE: We create the array of queueableFns preemptively,
// in order to keep a legacy, undocumented ordering of beforeEach execution.
// Specifically, this applies to beforeEach that were added inside of tests.
// Facebook depends on this behavior internally (see #5964 for discussion)
const queueableFns = wrapChildren(node, enabled);
return async function fn(done: (error?: any) => void = () => {}) {
nodeStart(node);
await queueRunnerFactory({
onException: error => node.onException(error),
queueableFns: wrapChildren(node, enabled),
queueableFns,
userContext: node.sharedUserContext(),
});
nodeComplete(node);
Expand Down

0 comments on commit bf654e1

Please sign in to comment.