jasmine-reqjs-jstd icon indicating copy to clipboard operation
jasmine-reqjs-jstd copied to clipboard

Is it possible to expand the jasmine-reqjs-jstd project to include a more complex solution?

Open pfilipsson opened this issue 13 years ago • 1 comments
trafficstars

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

pfilipsson avatar Sep 12 '12 13:09 pfilipsson

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

podefr avatar Sep 13 '12 20:09 podefr