blob: 138654d8d65454bd151a01854715cd5c18108381 [file] [log] [blame]
Paul Lewise441d1d2019-09-16 14:40:20 +00001// Copyright 2019 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Yang Guo236072b2019-10-04 20:31:17 +00005// TODO(1011259): switch to true.
Yang Guo4fd355c2019-09-19 10:59:03 +02006let external_devtools_frontend = true;
Yang Guo236072b2019-10-04 20:31:17 +00007let node_modules_path = external_devtools_frontend
8 ? ''
9 : '../../../../third_party/devtools-node-modules/third_party/node_modules/';
10
Paul Lewise441d1d2019-09-16 14:40:20 +000011module.exports = function(config) {
12 const options = {
Yang Guo236072b2019-10-04 20:31:17 +000013 basePath: '',
Paul Lewise441d1d2019-09-16 14:40:20 +000014
Tim van der Lippeb336f042019-11-07 15:54:25 +000015 files: [
16 {pattern: 'front_end/**/*.js', included: false, served: true}, {pattern: 'test/unittests/**/*.ts', type: 'module'}
17 ],
Paul Lewise441d1d2019-09-16 14:40:20 +000018
Yang Guo236072b2019-10-04 20:31:17 +000019 reporters: ['dots', 'coverage-istanbul'],
Paul Lewise441d1d2019-09-16 14:40:20 +000020
21 preprocessors: {
Yang Guod584b902019-10-14 12:17:30 +000022 './test/unittests/**/*.ts': ['karma-typescript'],
Al Muthanna Athaminace506bd2019-10-31 16:13:22 +010023 './front_end/common/*.js': ['karma-coverage-istanbul-instrumenter'],
Al Muthanna Athamina7eee1a62019-11-08 15:01:07 +010024 './front_end/workspace/*.js': ['karma-coverage-istanbul-instrumenter'],
25 './front_end/ui/*.js': ['karma-coverage-istanbul-instrumenter']
Paul Lewise441d1d2019-09-16 14:40:20 +000026 },
27
Yang Guo236072b2019-10-04 20:31:17 +000028 browsers: ['ChromeHeadless'],
Paul Lewise441d1d2019-09-16 14:40:20 +000029
Yang Guo236072b2019-10-04 20:31:17 +000030 frameworks: ['mocha', 'chai', 'karma-typescript'],
Paul Lewise441d1d2019-09-16 14:40:20 +000031
32 karmaTypescriptConfig: {
33 compilerOptions: {
Yang Guo236072b2019-10-04 20:31:17 +000034 target: 'esnext',
35 module: 'esnext',
Tim van der Lippeb336f042019-11-07 15:54:25 +000036 typeRoots: external_devtools_frontend ? undefined : [node_modules_path + '@types'],
37 lib: ['esnext', 'dom']
Paul Lewise441d1d2019-09-16 14:40:20 +000038 },
Tim van der Lippeb336f042019-11-07 15:54:25 +000039 coverageOptions: {instrumentation: false},
40 bundlerOptions: {resolve: {directories: [node_modules_path]}},
41 exclude: ['scripts']
Paul Lewise441d1d2019-09-16 14:40:20 +000042 },
43
44 proxies: {
45 '/front_end': '/base/front_end',
46 },
47
48 plugins: [
Tim van der Lippeb336f042019-11-07 15:54:25 +000049 'karma-chrome-launcher', 'karma-mocha', 'karma-chai', 'karma-typescript',
Yang Guo236072b2019-10-04 20:31:17 +000050 require(node_modules_path + 'karma-coverage-istanbul-instrumenter'),
51 require(node_modules_path + 'karma-coverage-istanbul-reporter')
Paul Lewise441d1d2019-09-16 14:40:20 +000052 ],
53
Tim van der Lippeb336f042019-11-07 15:54:25 +000054 coverageIstanbulInstrumenter: {esModules: true},
Paul Lewis4fd8f6e2019-09-30 15:05:45 +000055
Tim van der Lippeb336f042019-11-07 15:54:25 +000056 coverageIstanbulReporter: {reports: ['text', 'html'], dir: 'karma-coverage'},
Paul Lewis4fd8f6e2019-09-30 15:05:45 +000057
Paul Lewise441d1d2019-09-16 14:40:20 +000058 singleRun: true
59 };
60
61 config.set(options);
62};