Skip to content

Commit

Permalink
Don't assume exports is defined when window is undefined
Browse files Browse the repository at this point in the history
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
kevinoid committed Jul 19, 2012
1 parent dad4865 commit 442f3bf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/jasmine-core/jasmine.js
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/core/base.js
Original file line number Diff line number Diff line change
@@ -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.
Expand Down

0 comments on commit 442f3bf

Please sign in to comment.