Skip to content
forked from agrc/stub-module

StubModule.js - Stub AMD module dependencies for testing purposes when using the dojo AMD loader.

License

Notifications You must be signed in to change notification settings

lroche/StubModule

 
 

Repository files navigation

StubModule.js

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.

Setup

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();

Other Notes

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!

About

StubModule.js - Stub AMD module dependencies for testing purposes when using the dojo AMD loader.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published