From 442f3bf872202d56723a15ea44d33f35b2459a72 Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Thu, 19 Jul 2012 14:10:39 -0600 Subject: [PATCH] Don't assume exports is defined when window is undefined The current code makes the assumption that if window is undefined it is being run in an environment which supports the CommonJS Modules spec. This is not the case when Jasmine is being run in rhino or SpiderMonkey (smjs) without EnvJS. The fix is simply to check that exports is an object. Signed-off-by: Kevin Locke --- lib/jasmine-core/jasmine.js | 2 +- src/core/base.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 6bac2236..dca4fcb2 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -1,4 +1,4 @@ -var isCommonJS = typeof window == "undefined"; +var isCommonJS = typeof window == "undefined" && typeof exports == "object"; /** * Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework. diff --git a/src/core/base.js b/src/core/base.js index a4afea98..40d38aed 100644 --- a/src/core/base.js +++ b/src/core/base.js @@ -1,4 +1,4 @@ -var isCommonJS = typeof window == "undefined"; +var isCommonJS = typeof window == "undefined" && typeof exports == "object"; /** * Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework.