Testing javascript with Chutzpah and requirejs

后端 未结 3 2082
天涯浪人
天涯浪人 2021-02-14 04:31

I just wonder if there is a simple tutorial showing how to test javascript in visual studio with Chutzpah, require.js and jasmine.

Basically, i want to run the tests wi

3条回答
  •  一向
    一向 (楼主)
    2021-02-14 04:41

    I managed to make the tests run simply by adding an AMD module where i load all the test modules; That is, i created the all.test.js file in which i simply load all the test modules as dependencies:

    requirejs.config({
        // same as the applications main baseUrl
        baseUrl: '../',
    });
    
    requirejs([
          'tests/moduleA',
          'tests/moduleB'
        ],
        function () { }
    );
    

    In a sense, this is the main requires module for the test modules.

    Now you right click and open it in a browser or you can use the test runner to run the tests.

提交回复
热议问题