'use strict';

const os = require('os');

module.exports = (config) => {
  config.set({
    basePath: '',
    frameworks: [
      'jasmine-jquery',
      'jasmine'
    ],
    files: [
      // fixtures
      {
        pattern: './fixture/**/*',
        included: false
      },
      // testHelper
      '../../test/client/initHelper.js',
      // specs
      '../../test/client/specsContext.js'
    ],
    exclude: [],
    preprocessors: {
      '../../test/client/specsContext.js': ['webpack']
    },
    reporters: [
      'kjhtml',
      'mocha',
      'coverage'
    ],
    coverageReporter: {
      type: 'lcov',
      dir: '../../target/coverage/client'
    },
    webpack: {
      module: {
        rules: [
          {
            test: /\.js$/,
            use: 'isparta-loader',
            exclude: /(test|node_modules)\//
          },
          {
            test: /\.js$/,
            use: 'babel-loader',
            exclude: /node_modules\//
          },
          {
            test: /\.scss$/,
            use: [
              'css-loader',
              {
                loader: 'sass-loader',
                options: {outputStyle: 'compressed'}
              }
            ]
          }
        ]
      }
    },
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    browserConsoleLogOptions: {
      level: 'log',
      terminal: true
    },
    autoWatch: true,
    browsers: ['Chrome'],
    singleRun: false,
    concurrency: os.cpus().length
  });
};

'use strict';

const os = require('os');

module.exports = (config) => {
  config.set({
    basePath: '',
    frameworks: [
      'jasmine-jquery',
      'jasmine'
    ],
    files: [
      // fixtures
      {
        pattern: './fixture/**/*',
        included: false
      },
      // testHelper
      '../../test/client/initHelper.js',
      // specs
      '../../test/client/specsContext.js'
    ],
    exclude: [],
    preprocessors: {
      '../../test/client/specsContext.js': ['webpack']
    },
    reporters: [
      'kjhtml',
      'mocha',
      'coverage'
    ],
    coverageReporter: {
      type: 'lcov',
      dir: '../../target/coverage/client'
    },
    webpack: {
      module: {
        rules: [
          {
            test: /\.js$/,
            use: 'isparta-loader',
            exclude: /(test|node_modules)\//
          },
          {
            test: /\.js$/,
            use: 'babel-loader',
            exclude: /node_modules\//
          },
          {
            test: /\.scss$/,
            use: [
              'css-loader',
              {
                loader: 'sass-loader',
                options: {outputStyle: 'compressed'}
              }
            ]
          }
        ]
      }
    },
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    browserConsoleLogOptions: {
      level: 'log',
      terminal: true
    },
    autoWatch: true,
    browsers: ['ChromeHeadless'],
    singleRun: false,
    concurrency: os.cpus().length
  });
};

Use ChromeHeadless for karma tests