A method for mocking AMD dependencies when testing JavaScript modules using the Jasmine test suite and the Dojo AMD loader.
Inspired by this stackoverflow question and testr.
Open SpecRunner.html for a demo.
StubModule.js can be loaded like any other AMD module.
When you want to stub a module:
var StubbedModule = StubModule('path/to/module', {'dep': stub});
var testObject = new StubbedModule();
This project loads dojo and jasmine as git submodules so make sure that you run:
git submodule update --init --recursive
...after cloning the repository.
This will not work for the ESRI JSAPI prior to version 3.4. However, at 3.4 they turned on the dojo-undef-api has tag and it works great!