Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(treeProcessor): revert a small change from the #5585 refactoring
fixes #5964
moves the `wrapChildren` into higher scope to restore undocumented execution order
  • Loading branch information
niieani committed Apr 16, 2018
commit c682ca3421bedecab311283f188e8aa377e862bb
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