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 <email@example.com>