From 076093c16c9641882c4089438de34554b343fd69 Mon Sep 17 00:00:00 2001 From: Adam Milligan Date: Mon, 4 Nov 2019 11:38:53 -0500 Subject: [PATCH 1/3] Properly import jasmineRequire object before using --- lib/jasmine-core/boot.js | 1 + lib/jasmine-core/jasmine-html.js | 3 +++ 2 files changed, 4 insertions(+) diff --git a/lib/jasmine-core/boot.js b/lib/jasmine-core/boot.js index aa501180..fcd11f1b 100644 --- a/lib/jasmine-core/boot.js +++ b/lib/jasmine-core/boot.js @@ -31,6 +31,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ (function() { + var jasmineRequire = window.jasmineRequire || require('./jasmine.js'); /** * ## Require & Instantiate diff --git a/lib/jasmine-core/jasmine-html.js b/lib/jasmine-core/jasmine-html.js index aecf2f1b..d08611de 100644 --- a/lib/jasmine-core/jasmine-html.js +++ b/lib/jasmine-core/jasmine-html.js @@ -20,6 +20,9 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +var jasmineRequire = window.jasmineRequire || require('./jasmine.js'); + jasmineRequire.html = function(j$) { j$.ResultsNode = jasmineRequire.ResultsNode(); j$.HtmlReporter = jasmineRequire.HtmlReporter(j$); From 3d1a96e020e97ceb20d3944fdd42bad81509e0b2 Mon Sep 17 00:00:00 2001 From: Adam Milligan Date: Tue, 5 Nov 2019 10:54:46 -0500 Subject: [PATCH 2/3] Extend Jasmine env into correct global --- lib/jasmine-core/boot.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/jasmine-core/boot.js b/lib/jasmine-core/boot.js index fcd11f1b..b46871cf 100644 --- a/lib/jasmine-core/boot.js +++ b/lib/jasmine-core/boot.js @@ -38,7 +38,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Require Jasmine's core files. Specifically, this requires and attaches all of Jasmine's code to the `jasmine` reference. */ - window.jasmine = jasmineRequire.core(jasmineRequire); + var jasmine = jasmineRequire.core(jasmineRequire), + global = jasmine.getGlobal(); + global.jasmine = jasmine; /** * Since this is being run in a browser and the results should populate to an HTML page, require the HTML-specific Jasmine code, injecting the same reference. @@ -60,7 +62,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /** * Add all of the Jasmine global/public interface to the global scope, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`. */ - extend(window, jasmineInterface); + extend(global, jasmineInterface); /** * ## Runner Parameters From 13ff1e037e86378a8aa49e7a0003c96c86a7a905 Mon Sep 17 00:00:00 2001 From: Adam Milligan Date: Fri, 22 Nov 2019 17:47:20 -0500 Subject: [PATCH 3/3] Make changes in source files --- lib/jasmine-core/boot/boot.js | 7 +++++-- lib/jasmine-core/jasmine-html.js | 1 - src/html/requireHtml.js | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/jasmine-core/boot/boot.js b/lib/jasmine-core/boot/boot.js index 2d684628..e1e20f1c 100644 --- a/lib/jasmine-core/boot/boot.js +++ b/lib/jasmine-core/boot/boot.js @@ -9,13 +9,16 @@ */ (function() { + var jasmineRequire = window.jasmineRequire || require('./jasmine.js'); /** * ## Require & Instantiate * * Require Jasmine's core files. Specifically, this requires and attaches all of Jasmine's code to the `jasmine` reference. */ - window.jasmine = jasmineRequire.core(jasmineRequire); + var jasmine = jasmineRequire.core(jasmineRequire), + global = jasmine.getGlobal(); + global.jasmine = jasmine; /** * Since this is being run in a browser and the results should populate to an HTML page, require the HTML-specific Jasmine code, injecting the same reference. @@ -37,7 +40,7 @@ /** * Add all of the Jasmine global/public interface to the global scope, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`. */ - extend(window, jasmineInterface); + extend(global, jasmineInterface); /** * ## Runner Parameters diff --git a/lib/jasmine-core/jasmine-html.js b/lib/jasmine-core/jasmine-html.js index d08611de..a727d01e 100644 --- a/lib/jasmine-core/jasmine-html.js +++ b/lib/jasmine-core/jasmine-html.js @@ -20,7 +20,6 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - var jasmineRequire = window.jasmineRequire || require('./jasmine.js'); jasmineRequire.html = function(j$) { diff --git a/src/html/requireHtml.js b/src/html/requireHtml.js index b60c3ba5..a8fe2a1e 100644 --- a/src/html/requireHtml.js +++ b/src/html/requireHtml.js @@ -1,3 +1,5 @@ +var jasmineRequire = window.jasmineRequire || require('./jasmine.js'); + jasmineRequire.html = function(j$) { j$.ResultsNode = jasmineRequire.ResultsNode(); j$.HtmlReporter = jasmineRequire.HtmlReporter(j$);