1/*
2 * Copyright (C) 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16const path = require('path');
17const webpackConfig = require('./webpack.config.common');
18delete webpackConfig.entry;
19delete webpackConfig.output;
20
21module.exports = (config) => {
22  config.set({
23    frameworks: ['jasmine', 'webpack'],
24    plugins: [
25      'karma-webpack',
26      'karma-chrome-launcher',
27      'karma-jasmine',
28      'karma-sourcemap-loader',
29    ],
30    files: [
31      {pattern: 'src/main_unit_test.ts', watched: false},
32      {pattern: 'src/test/fixtures/**/*', included: false, served: true},
33      {
34        pattern: 'deps_build/trace_processor/to_be_served/engine_bundle.js',
35        included: false,
36        served: true,
37      },
38      {
39        pattern: 'deps_build/trace_processor/to_be_served/trace_processor.wasm',
40        included: false,
41        served: true,
42      },
43    ],
44    reporters: ['progress'],
45    preprocessors: {
46      'src/main_unit_test.ts': ['webpack', 'sourcemap'],
47    },
48    verbose: true, // output config used by istanbul for debugging
49    webpack: webpackConfig,
50  });
51};
52