How can I mock dependencies for unit testing in RequireJS?
So after reading this post I came up with a solution that use the requirejs config function to create a new context for your test where you can simply mock your dependencies: var cnt = 0; function createContext(stubs) { cnt++; var map = {}; var i18n = stubs.i18n; stubs.i18n = { load: sinon.spy(function(name, req, onLoad) … Read more