// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular-devkit/build-angular'],
    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('@angular-devkit/build-angular/plugins/karma')
    ],
    files: [
      "src/assets/scripts/highlight.js",
      "node_modules/twemoji/dist/twemoji.min.js",
      "node_modules/simple-markdown/simple-markdown.js",
    ],
    client: {
      clearContext: false // leave Jasmine Spec Runner output visible in browser
    },
    coverageIstanbulReporter: {
      dir: require('path').join(__dirname, './coverage/NanoWebapp'),
      reports: ['html', 'lcovonly', 'text-summary'],
      fixWebpackSourcePaths: true
    },
    reporters: ['progress', 'kjhtml'],
    protocol: 'http:',
    hostname: 'localhost',
    port: 4200,
    upstreamProxy: {
      protocol: 'https:',
      hostname: 'nano.clarabot.dev',
      port: 443
    },
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['Chrome'],
    singleRun: false,
    restartOnFileChange: true,
    proxies: {
      "/debug/crypto/configs": {
        "target": "https://nano.clarabot.dev",
        "changeOrigin": true
      },
      "/debug/crypto/gen-key": {
        "target": "https://nano.clarabot.dev",
        "changeOrigin": true
      },
      "/debug/crypto/dump": {
        "target": "https://nano.clarabot.dev",
        "changeOrigin": true
      },
      "/debug/crypto/load": {
        "target": "https://nano.clarabot.dev",
        "changeOrigin": true
      },
      "rest/csrf": {
        "target": "https://nano.clarabot.dev",
        "changeOrigin": true
      },
      "wsgql": {
        "target": "https://nano.clarabot.dev",
        "changeOrigin": true
      },
      //"/nanodev": "http://localhost:3001/",
    }
  });
};
