I'm only looking for dependency injection in my unit test strategy using RequireJS and Jasmine. I really like the idea of testr , and I tried installing testr following the examples on github, but I cannot figure out what is wrong, I always get an error
Error: module was not loaded: today
when testr tries to load the module to be tested.
Here is the context ..
index.html ..
<script data-main="config" src="../../assets/js/libs/require.js"></script> <script src="vendor/testr.js"></script>
config.js ..
require.config({ // Initialize specs. deps:["main"], ... ... });
main.js ..
require([ // Load the example spec, replace this and add your own spec "spec/today" ], function() { var jasmineEnv = jasmine.getEnv(); jasmineEnv.execute(); });
specifications \ today.js ..
describe('Today print', function() { var date = {}, today; beforeEach(function() { date.today = new Date(2012, 3, 30); today = testr('today', {'util/date': date});
today.js ..
define(['string', 'util/date'], function(string, date) { return { getDateString: function() { return string.format('Today is %d', date.today); } } });
Does anyone have the same problems ?, I'm using RequireJS 2.0.6
Thanks.
dependency-injection unit-testing requirejs jasmine
aschiavoni
source share