angularkarma-jasmineangular8angular-test

Set order for Angular 8 tests


One of my tests fails randomly. I want to set some order for debugging as by default tests run randomly with seed. I tried to set seed number in karma.conf.js or set random: false but no effect. I use default test configuration and run test with ng test. My changes in karma.conf.js:

client: {
   ...
   random: false,
   //or
   seed: '71384' 
   ...
}

Solution

  • this documentation shows how to set test order in karma.conf for jasmine tests.

    https://github.com/karma-runner/karma-jasmine

    in karma.conf you must have (see 'random: false' in config):

     module.exports = function(config) {
      config.set({
        client: {
          jasmine: {
            random: false,
          }
        }
      })
    }