From 225c7bdda360af2312eeb1c9eb16eea9c36b42d8 Mon Sep 17 00:00:00 2001 From: Robert Neumann Date: Mon, 11 May 2015 10:29:51 -0700 Subject: [PATCH] Set the shared user context correctly when executing the top level suite Fixes #846 --- lib/jasmine-core/jasmine.js | 1 + spec/core/TreeProcessorSpec.js | 6 ++++-- src/core/TreeProcessor.js | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 0b6964b7..d180c032 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -2208,6 +2208,7 @@ getJasmineRequireObj().TreeProcessor = function() { queueRunnerFactory({ queueableFns: childFns, + userContext: tree.sharedUserContext(), onException: function() { tree.onException.apply(tree, arguments); }, diff --git a/spec/core/TreeProcessorSpec.js b/spec/core/TreeProcessorSpec.js index 28c4dde7..b6c790ae 100644 --- a/spec/core/TreeProcessorSpec.js +++ b/spec/core/TreeProcessorSpec.js @@ -202,7 +202,7 @@ describe("TreeProcessor", function() { it("runs a single leaf", function() { var leaf = new Leaf(), - node = new Node({ children: [leaf] }), + node = new Node({ children: [leaf], userContext: { root: 'context' } }), queueRunner = jasmine.createSpy('queueRunner'), processor = new j$.TreeProcessor({ tree: node, runnableIds: [leaf.id], queueRunnerFactory: queueRunner }), treeComplete = jasmine.createSpy('treeComplete'); @@ -212,6 +212,7 @@ describe("TreeProcessor", function() { expect(queueRunner).toHaveBeenCalledWith({ onComplete: treeComplete, onException: jasmine.any(Function), + userContext: { root: 'context' }, queueableFns: [{ fn: jasmine.any(Function) }] }); @@ -222,7 +223,7 @@ describe("TreeProcessor", function() { it("runs a node with no children", function() { var node = new Node({ userContext: { node: 'context' } }), - root = new Node({ children: [node] }), + root = new Node({ children: [node], userContext: { root: 'context' } }), nodeStart = jasmine.createSpy('nodeStart'), nodeComplete = jasmine.createSpy('nodeComplete'), queueRunner = jasmine.createSpy('queueRunner'), @@ -241,6 +242,7 @@ describe("TreeProcessor", function() { expect(queueRunner).toHaveBeenCalledWith({ onComplete: treeComplete, onException: jasmine.any(Function), + userContext: { root: 'context' }, queueableFns: [{ fn: jasmine.any(Function) }] }); diff --git a/src/core/TreeProcessor.js b/src/core/TreeProcessor.js index 275cb6aa..654c47a0 100644 --- a/src/core/TreeProcessor.js +++ b/src/core/TreeProcessor.js @@ -29,6 +29,7 @@ getJasmineRequireObj().TreeProcessor = function() { queueRunnerFactory({ queueableFns: childFns, + userContext: tree.sharedUserContext(), onException: function() { tree.onException.apply(tree, arguments); },