A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/mroderick/PubSubJS/issues/51 below:

Problem with loading Karma test runner · Issue #51 · mroderick/PubSubJS · GitHub

The following code works fine in the browser with AMD but doesn't work in Karma test runner:

define(['pubsub'], function (pubsub) {
  pubsub.publish('test');
});

In Karma, pubsub is undefined, because it takes the route of common js thinking that module is defined

// CommonJS
if (typeof exports === 'object' && typeof module !== 'undefined'){
    module.exports = factory();

// AMD
} else if (typeof define === 'function' && define.amd){
    define(factory);
// Browser
} else {
    root.PubSub = factory();
}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4