Echo JS 0.11.0

<~>

amatiasq comments

amatiasq 3901 days ago. link 1 point
sbruchmann: Sorry, I forget it, should I delete it?
amatiasq 4097 days ago. link 1 point
No tool is really important, it's just useful. It's not very known but RequireJS allows you to load files on diferent "contexts", I use this to create one context per test suite so in this context I can mock specific dependencies and they are not loaded.

I use "Multiversion" API to create one context per suite and "map" config parameter to mock dependencies:

http://www.requirejs.org/docs/api.html#config-map

http://www.requirejs.org/docs/api.html#multiversion


    requirejs.config({
      map: {
        'models/user': {
          'srv/auth': 'test/mocks/srv/auth'
        };
      };
    });

    define(function(require) {
      // if "../models/users" ask for module "srv/auth" require will delivery "test/mocks/srv/auth" instead
      var userModel = require('../models/user');
      // test
    });