process.env.CHROME_BIN = require('puppeteer').executablePath()

const webpack = require('./webpack.config');

delete webpack['entry'];
delete webpack['output'];
delete webpack['plugins'];
webpack['mode'] = 'development';

module.exports = (config) => {
    config.set({
        basePath: '',
        frameworks: ['jasmine'],
        files: [
            // 'legacy/spec/lib/jasmine-species/jasmine-grammar.js',
            'legacy/spec/lib/jasmine-matchers.js',
            // 'legacy/spec/lib/jasmine-ajax/mock-ajax.js',
            'node_modules/jasmine-ajax/lib/mock-ajax.js',
            'node_modules/jasmine-species/jasmine-grammar.js',
            'legacy/spec/lib/i18n/i18n.js',
            // 'legacy/spec/lib/matchers.js',
            'legacy/spec/lib/analytics.js',
            'node_modules/mithril/mithril.js',
            'node_modules/underscore/underscore.js',
            'node_modules/liquidjs/dist/liquid.js',
            'node_modules/mithril-postgrest/mithril-postgrest.umd.js',
            'node_modules/chart.js/Chart.js',
            'node_modules/moment/moment.js',
            'node_modules/select/dist/select.js',
            'node_modules/jquery/dist/jquery.min.js',
            'legacy/vendor/replaceDiacritics.js',
            'legacy/spec/lib/mocks/*mock.js',
            'legacy/spec/index.spec.js',
        ],
        preprocessors: {
            'legacy/spec/lib/mithril-query/mithril-query.js' : ['webpack'],
            'legacy/spec/**/*.spec.js': ['webpack'],
            'legacy/spec/index.spec.js': ['webpack']
        },
        webpack,
        exclude: [],
        reporters: ['spec'],
        port: 9876,
        colors: true,
        logLevel: config.LOG_INFO,
        browsers: ['MyHeadlessChrome'],
        customLaunchers: {
            MyHeadlessChrome: {
                base: 'ChromeHeadless',
                flags: ['--headless', '--no-sandbox']
            }
        },
        singleRun: true
    });
};

@@ -184,41 +184,8 @@
 s'%5D;
-%0Awebpack%5B'mode'%5D = 'development';
 %0A%0Amo

remove webackmode to auto discover