Don't assume exports is defined when window is undefined #257

Merged
merged 1 commit into from Sep 3, 2012

Projects

None yet

2 participants

@kevinoid
Contributor

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 (e.g. using either http://stackoverflow.com/a/5767884 or https://gist.github.com/3146420 to provide setTimeout).

The attached commit fixes the issue by checking that exports is an object.

@kevinoid kevinoid 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>
442f3bf
@infews infews merged commit 39a55d8 into jasmine:master Sep 3, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment