How to expose javascript objects for unit testing without polluting the global namespace
问题 I have a javascript autocomplete plugin that uses the following classes (written in coffeescript): Query, Suggestion, SuggestionCollection, and Autocomplete. Each of these classes has an associated spec written in Jasmine. The plugin is defined within a module, e.g.: (function(){ // plugin... }).call(this); This prevents the classes from polluting the global namespace, but also hides them from any tests (specs with jasmine, or unit-tests with something like q-unit). What is the best way to