jnicklas/evergreen — pull request #46 by zhougn (2012-01-01 15:09:01+00:00)
Title: should load js files required in spec_helper.js before spec js files loaded

Here's my simple test case.

Given I have public/javascripts/hello.js which declares a variable:

var hello = 'hello';

And have spec_helper file like:

require('/javascripts/hello.js');

And here comes the hello_spec.js:

console.log(hello);

Then I run the spec in browser, I get an error 'ReferenceError: Can't find variable: hello'.

I find the rendered spec web runner has some html snippet like following:

Though hello.js is required at the very beginning, it is loaded after the test code executed.

Please check out my solution, I'm not sure if it affects anything else.