cucumber/cucumber-js — pull request #56 by renier (2012-04-10 06:05:46+00:00)
Title: Making cucumber-js compatible with requirejs

- Addition of pretty printer.
- Make cucumber library callable in browser environment where require() and define() have already been defined in the require.js style. This makes it possible to inject cucumber-js in a page with Dojo, for example, in a headless browser (e.g. phantomjs) with pretty printed output to the console.

Had to fix circular requirejs dependencies that broke cucumber in the browser in my previous pull request. Now everything looks like it's ok. Cucumber/Jasmime tests all pass. Tested the example server page. Tested in phantomjs with dojo toolkit.

Unfortunately, the way that jasmine requires a scope object to spy on a method, prevents you from requiring a dependency directly in the requirejs scope. So you have to require a level above you so that the tests can pass. But this gets you into a circular dependency situation. Thankfully, requirejs allows for a way to resolve this at module runtime by providing a synchronous version of require() after all modules have loaded.