Setting up Jasmine with ExtJS for Unit Testing - Build the app and spec files

 Build the app-test.js file

Now cut and paste the code from your existing app.js file into a new file called app-test.js (in the project directory). If you use Architect like I do, it will look like this:

// File app-test.js
Ext.Loader.setConfig({
    enabled: true
});

Ext.application({
    models: [
        'Car'
    ],
    stores: [
        'Cars'
    ],
    views: [
        'InitialView'
    ],
    autoCreateViewport: true,
    controllers: [
        'Main'
    ],
    name: 'JasmineExample'
});

 To the application config, add a launch function with the contents below. If the launch function already exists in your code, just add the two Jasmine lines.

    launch: function() {
            jasmine.getEnv().addReporter(new jasmine.TrivialReporter());
            jasmine.getEnv().execute();    
    }

When complete, the file will look like this:

// File app-test.js
Ext.require('Ext.app.Application');

Ext.Loader.setConfig({
    enabled: true
});

Ext.application({
       models: [
        'Car'
    ],
    stores: [
        'Cars'
    ],
    views: [
        'InitialView'
    ],
    autoCreateViewport: true,
    name: 'JasmineExample',

// ---------Inserted launch function -----------
    launch: function() {
            jasmine.getEnv().addReporter(new jasmine.TrivialReporter());
            jasmine.getEnv().execute();    
    }
// --------------------------------------------
});


Create an empty spec file and test the Jasmine installation

Lastly, create the spec file (but leave it empty) referenced in run-tests.html (app-test/specs/initial.js) or modify the entry and create your own.

If all went well you should now be able to run the tests by calling projDir/run-tests.html in your favorite browser.

 Jasmine Success