Pass an argument to jasmine unit test from karma?

I have some unit tests in which I use server paths to hit my breadboard stubs. I am currently adding a URL to each test. I would really like to pass this URL from my gulp task to unit tests. Is it possible?

  require('.path_to_my_karma').apply(null, [].concat(args).concat([**host_url**]));
+4
source share
1 answer

At startup, karmayou can pass custom parameters;

karma start --my-custom-url http://google.com

Then in yours karma.conf.jsyou can access them like this:

module.exports = function(config) {
  console.log('URL passed in from command line is %s', config.myCustomUrl);
  config.set({
    // ...
  });
};
0
source

Source: https://habr.com/ru/post/1619683/


All Articles