Skip to content

Commit

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

fixes jestjs#5964
moves the `wrapChildren` into higher scope to restore undocumented execution order
  • Loading branch information
niieani committed Apr 16, 2018
1 parent 70e7ac2 commit c682ca3
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 c682ca3

Please sign in to comment.