<commit_before>import * as webpack from 'webpack';
import * as ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
import * as StyleLintPlugin from 'stylelint-webpack-plugin';
import * as FilterWarningsPlugin from 'webpack-filter-warnings-plugin';
import * as WebpackKarmaDieHardPlugin from '@mattlewis92/webpack-karma-die-hard';

export default config => {
  config.set({

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: './',

    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['mocha'],

    // list of files / patterns to load in the browser
    files: [
      'test/entry.ts'
    ],

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
      'test/entry.ts': ['webpack', 'sourcemap']
    },

    webpack: {
      resolve: {
        extensions: ['.ts', '.js', '.json']
      },
      module: {
        rules: [{
          enforce: 'pre',
          test: /\.ts$/,
          loader: 'tslint-loader',
          exclude: /node_modules/,
          options: {
            emitErrors: config.singleRun,
            failOnHint: config.singleRun
          }
        }, {
          test: /\.ts$/,
          loader: 'ts-loader',
          exclude: /node_modules/,
          options: {
            transpileOnly: true,
            compilerOptions: {
              module: 'esnext'
            }
          }
        }, {
          test: /\.scss$/,
          loader: 'style-loader!css-loader!sass-loader',
          exclude: /node_modules/
        }, {
          enforce: 'post',
          test: /src\/.+\.ts$/,
          exclude: /(node_modules|\.spec\.ts$|\.interface\.ts$)/,
          loader: 'istanbul-instrumenter-loader',
          options: {
            esModules: true
          }
        }]
      },
      plugins: [
        new FilterWarningsPlugin({
          exclude: /export '\w+' was not found in 'calendar-utils'/
        }),
        ...(config.singleRun ? [
          new WebpackKarmaDieHardPlugin(),
          new webpack.NoEmitOnErrorsPlugin(),
          new StyleLintPlugin({
            syntax: 'scss',
            context: 'scss',
            failOnError: true
          })
        ] : []),
        new ForkTsCheckerWebpackPlugin({
          watch: ['./src', './test'],
          async: !config.singleRun,
          formatter: 'codeframe'
        }),
        new webpack.SourceMapDevToolPlugin({
          filename: null,
          columns: config.singleRun,
          test: /\.(ts|js)($|\?)/i
        }),
        new webpack.ContextReplacementPlugin(
          /angular(\\|\/)core(\\|\/)@angular/,
          __dirname + '/src'
        )
      ]
    },

    mochaReporter: {
      showDiff: true,
      output: 'autowatch'
    },

    coverageIstanbulReporter: {
      reports: ['text-summary', 'html', 'lcovonly'],<commit_msg>Revert "test: fix coverage reports on single test runs"<commit_after>import * as webpack from 'webpack';
import * as ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
import * as StyleLintPlugin from 'stylelint-webpack-plugin';
import * as FilterWarningsPlugin from 'webpack-filter-warnings-plugin';
import * as WebpackKarmaDieHardPlugin from '@mattlewis92/webpack-karma-die-hard';

export default config => {
  config.set({

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: './',

    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['mocha'],

    // list of files / patterns to load in the browser
    files: [
      'test/entry.ts'
    ],

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
      'test/entry.ts': ['webpack', 'sourcemap']
    },

    webpack: {
      resolve: {
        extensions: ['.ts', '.js', '.json']
      },
      module: {
        rules: [{
          enforce: 'pre',
          test: /\.ts$/,
          loader: 'tslint-loader',
          exclude: /node_modules/,
          options: {
            emitErrors: config.singleRun,
            failOnHint: config.singleRun
          }
        }, {
          test: /\.ts$/,
          loader: 'ts-loader',
          exclude: /node_modules/,
          options: {
            transpileOnly: true,
            compilerOptions: {
              module: 'esnext'
            }
          }
        }, {
          test: /\.scss$/,
          loader: 'style-loader!css-loader!sass-loader',
          exclude: /node_modules/
        }, {
          enforce: 'post',
          test: /src\/.+\.ts$/,
          exclude: /(node_modules|\.spec\.ts$|\.interface\.ts$)/,
          loader: 'istanbul-instrumenter-loader',
          options: {
            esModules: true
          }
        }]
      },
      plugins: [
        new FilterWarningsPlugin({
          exclude: /export '\w+' was not found in 'calendar-utils'/
        }),
        ...(config.singleRun ? [
          new WebpackKarmaDieHardPlugin(),
          new webpack.NoEmitOnErrorsPlugin(),
          new StyleLintPlugin({
            syntax: 'scss',
            context: 'scss',
            failOnError: true
          })
        ] : []),
        new ForkTsCheckerWebpackPlugin({
          watch: ['./src', './test'],
          async: !config.singleRun,
          formatter: 'codeframe'
        }),
        new webpack.SourceMapDevToolPlugin({
          filename: null,
          columns: false,
          test: /\.(ts|js)($|\?)/i
        }),
        new webpack.ContextReplacementPlugin(
          /angular(\\|\/)core(\\|\/)@angular/,
          __dirname + '/src'
        )
      ]
    },

    mochaReporter: {
      showDiff: true,
      output: 'autowatch'
    },

    coverageIstanbulReporter: {
      reports: ['text-summary', 'html', 'lcovonly'],
{'fraction_non_alphanumeric': 0.14059636848242546, 'fraction_numerical': 0.0006663334999167084, 'mean_word_length': 1.7365542388331814, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1819262', 'n_tokens_mistral': 1779, 'n_tokens_neox': 1730, 'n_words': 375}