text: // https://github.com/karma-runner/karma-chrome-launcher
  process.env.CHROME_BIN = require("puppeteer").executablePath();
  require("dotenv").config({ path: "../.env" });
  
  module.exports = function(config) {
    config.set({
      basePath: "./",
      frameworks: ["mocha"],
  
      plugins: [
        "karma-mocha",
        "karma-mocha-reporter",
        "karma-chrome-launcher",
        "karma-edge-launcher",
        "karma-firefox-launcher",
        "karma-ie-launcher",
        "karma-env-preprocessor",
        "karma-coverage",
        "karma-sourcemap-loader",
        "karma-junit-reporter"
      ],
  
      files: [
        // polyfill service supporting IE11 missing features
        // Promise,String.prototype.startsWith,String.prototype.endsWith,String.prototype.repeat,String.prototype.includes,Array.prototype.includes,Object.keys
        "https://cdn.polyfill.io/v2/polyfill.js?features=Promise,String.prototype.startsWith,String.prototype.endsWith,String.prototype.repeat,String.prototype.includes,Array.prototype.includes,Object.keys|always",
        "dist-test/index.browser.js",
        { pattern: "dist-test/index.browser.js.map", type: "html", included: false, served: true }
      ],
  
      exclude: [],
  
      preprocessors: {
        "**/*.js": ["sourcemap", "env"]
        //"dist-test/index.browser.js": ["coverage"]
      },
  
      reporters: ["mocha", "coverage", "junit"],
  
      coverageReporter: {
        // specify a common output directory
        dir: "coverage-browser/",
        reporters: [
          { type: "json", subdir: ".", file: "coverage.json" },
          { type: "lcovonly", subdir: ".", file: "lcov.info" },
          { type: "html", subdir: "html" },
          { type: "cobertura", subdir: ".", file: "cobertura-coverage.xml" }
        ]
      },
  
      junitReporter: {
        outputDir: "",
        outputFile: "test-results.browser.xml",
        suite: "",
        useBrowserName: false,
        nameFormatter: undefined,
        classNameFormatter: undefined,
        properties: {}
      },
  
      port: 9328,
      colors: true,
      logLevel: config.LOG_INFO,
      autoWatch: false,
  
      // --no-sandbox allows our tests to run in Linux without having to change the system.
      browsers: ["ChromeHeadlessNoSandbox"],
      customLaunchers: {
        ChromeHeadlessNoSandbox: {
          base: "ChromeHeadless",
          flags: ["--no-sandbox"]
        }
      },
  
      singleRun: false,
      concurrency: 1,
  
      browserNoActivityTimeout: 600000,
      browserDisconnectTimeout: 10000,
      browserDisconnectTolerance: 3,
  
      client: {
        mocha: {
          // change Karma's debug.html to the mocha web reporter
          reporter: "html",
          timeout: "600000"
        }
      }
    });
  };
  