Search code examples
azure-devopsjasmine

Running Jasmine tests on Azure DevOps as part of automated build process


Given the build has an Angular app as part of it, there are Jasmine tests in there. What do I have to do to get those test results published as part of the build and better yet, gate the build result on successful execution of all Jasmine tests?


Solution

  • @uminder's Azure configuration is correct.

    I would add two things so the answer is complete. This is needed in order to create junit reports and coverage files - so you can later refer them in azure pipeline.

    1. junit and coverage (if not present) reporter to karma.config.js
     config.set({
          plugins: [
            ...
            require('karma-coverage'),
            require('karma-junit-reporter')
          ]
    

    Of course you need to install it

    npm install -D karma-junit-reporter

    1. I would also add a cobertura in coverageReporter in to karma.config.js

       coverageReporter:  { 
       ....
       reporters: [
           ...
           { type: 'cobertura' } // TO BE ADDED        
       ]
      

      }