Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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 <kevin@kevinlocke.name>
  • Loading branch information...
commit 442f3bf872202d56723a15ea44d33f35b2459a72 1 parent dad4865
@kevinoid kevinoid authored
Showing with 2 additions and 2 deletions.
  1. +1 −1  lib/jasmine-core/jasmine.js
  2. +1 −1  src/core/base.js
View
2  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.
View
2  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.
Please sign in to comment.
Something went wrong with that request. Please try again.