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>
This commit is contained in:
Kevin Locke
2012-07-19 14:10:39 -06:00
committed by Davis W. Frank & Rajan Agaskar
parent c5ba032d28
commit 26f0f6f213
2 changed files with 2 additions and 2 deletions

View File

@@ -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 File

@@ -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.