jasmine-reqjs-jstd
jasmine-reqjs-jstd copied to clipboard
Is it possible to expand the jasmine-reqjs-jstd project to include a more complex solution?
Hello! Like many others, I am currently trying to incorportate automatic testing of javascript in my projects. I like your example, but I wish the requirejs part was a bit more complex. Requirejs is used to keep track of dependencies, meaning more than one js file. In the project I would like to test, I am using knockout. To test the viewmodel I need to include knockout among other things. I just got the requirejs part to work. My main.js file looks as follows:
baseUrl: '../../../resources/js',
paths: {
jquery: 'lib/jquery/jquery',
knockout: 'lib/ko/knockout',
jqu: 'lib/jquery',
jit: 'lib/jit/jit',
kno: 'lib/ko',
bos: 'lib/bootstrap'
},
shim: {
'jit': 'lib/config/global',
'handlers': 'jit'
}
});
require([
'jquery',
'knockout',
'kno/knockout.mapping-latest',
'src/viewmodels/customersoverview',
'jqu/activity-indicator',
'src/extends/handlers',
'lib/domReady!'
], function ($, ko, ko_mapping, CustomersOverviewModel) {
var customersOverviewViewModel;
customersOverviewViewModel = new CustomersOverviewModel();
customersOverviewViewModel.getPersistedModelData();
ko.applyBindings(customersOverviewViewModel);
});
I was kind of hoping I could have written a similar require section for the test. If I have to include everything manually again I feel we kind of lose the point of using something like requirejs.
Kind regards Patrik Filipsson Sofware developer FindOut Technologies
Hi Patrick,
Thank you for your interest. I can't answer you right now as I'm lacking time but I will dig into it next week and will keep you updated.
Regards, Olivier