mardi 29 mars 2016

Output Jasmine test results report in JSON using jasmine-json-test-reporter

I am running unit test using Jasmine and requireJS. The code works fines and executes the unit tests as required. It outputs the test results in XML files using Junit but I am trying to add jasmine-json-test-reporter to output them to JSON. But I don't know how to add it in the grunt task. Below is my config settings for Jasmine in grunt.js

var conf = {

        src: src,
        options: {
            template: require('grunt-template-jasmine-istanbul'),
            specs: [
                      '../http://ift.tt/1TfRiKS' + name + '/**/*.js'
            ],
            helpers: [
                    'Assets/scripts/ato/helperscript.js',
                   ],
            vendor: arr,
            templateOptions: {
               coverage: 'coverage.json',
                report: {
                    type: 'html',
                    options: {
                        dir: 'coverage'
                    }
                },
                thresholds: {
                    lines: 75,
                    statements: 75,
                    branches: 75,
                    functions: 90
                },
                template: require('grunt-template-jasmine-requirejs'),
                templateOptions: {
                    requireConfig: {
                        baseUrl: 'SinglePageApplications/' + name,
                        //waitSeconds: 30,
                        paths: mixIn({
                            'knockout-editables': '../../Assets/scripts/vendor/ko.editables-0.9.0',
                            'knockout-validation': '../../Assets/scripts/vendor/knockout.validation-1.0.2',
                            'bignumber': '../../Assets/scripts/vendor/bignumber-1.4.1',
                            'testutils': '../../../http://ift.tt/21QCPFA',
                            'shared': '../../Legacy/Shared',
                            'testdata': '../../../http://ift.tt/1TfRiKS' + name + '/testdata'
                        }, addConfigurationPaths(app))

                    }
                },
                                   junit: {
                    path: 'build/junit/' + name + '/' //this is output the test results in XML
                },
              }
        }
            ,
        //specs : 'src/test/js/unit-headless.html',

        phantomjs: {
            'ignore-ssl-errors': true
        },


    }


    return conf;
};

I have read through documentation on http://ift.tt/1TfRiKV But I am not too sure how can I add this to my grunt task so that it generates report as the unit test cases are executed?

Aucun commentaire:

Enregistrer un commentaire