1 const path
= require('path');
2 const os
= require('os');
3 const { firefox
, chromium
, webkit
} = require('playwright');
4 const karmaJasmine
= require('karma-jasmine');
5 const karmaWebpack
= require('karma-webpack');
6 const karmaChromeLauncher
= require('karma-chrome-launcher');
7 const karmaFirefoxLauncher
= require('karma-firefox-launcher');
8 const karmaWebkitLauncher
= require('karma-webkit-launcher');
9 const karmaSpecReporter
= require('karma-spec-reporter');
10 process
.env
.CHROME_BIN
= chromium
.executablePath();
11 process
.env
.FIREFOX_BIN
= firefox
.executablePath();
12 process
.env
.WEBKIT_HEADLESS_BIN
= webkit
.executablePath();
15 * Karma does not automatically serve the bundled webworker asset generated by webpack,
16 * so we need to manually reference and expose the webpack temporary output dir.
17 * See: https://github.com/ryanclark/karma-webpack/issues/498#issuecomment-790040818
19 const karmaWebpackOutputPath
= path
.join(os
.tmpdir(), '_karma_webpack_') + Math
.floor(Math
.random() * 1000000);
21 module
.exports = function (config
) {
23 // base path that will be used to resolve all patterns (eg. files, exclude)
27 // available frameworks: https://www.npmjs.com/search?q=keywords:karma-adapter
28 frameworks
: ['jasmine', 'webpack'],
34 process
.env
.CI
? undefined : karmaFirefoxLauncher
,
39 // list of files / patterns to load in the browser
41 { pattern
: 'test/**/!(karma.conf).*', watched
: false },
43 pattern
: `${karmaWebpackOutputPath}/**/*`,
50 // list of files / patterns to exclude
53 // preprocess matching files before serving them to the browser
54 // available preprocessors: https://www.npmjs.com/search?q=keywords:karma-preprocessor
56 'test/**/*.*': 'webpack',
61 path
: karmaWebpackOutputPath
,
69 extensions
: ['', '.js', '.ts'],
79 compilerOptions
: { noEmit
: false },
80 allowTsInNodeModules
: true,
84 exclude
: /node_modules\/(?!.*(pmcrypto))/,
90 // available reporters: https://www.npmjs.com/search?q=keywords:karma-reporter
96 // enable / disable colors in the output (reporters and logs)
100 // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
101 logLevel
: config
.LOG_INFO
,
103 // enable / disable watching file and executing tests whenever any file changes
108 base
: 'ChromeHeadless',
109 flags
: ['--no-sandbox'],
112 browsers
: ['ChromeHeadlessCI', process
.env
.CI
? undefined : 'FirefoxHeadless', 'WebkitHeadless'].filter(
116 // Continuous Integration mode
117 // if true, Karma captures browsers, runs the tests and exits
121 // how many browser instances should be started simultaneously
122 concurrency
: Infinity
,
126 // Run tests in serial so that endpoint release don't interfere
128 // timeout for tests, default is 2 seconds. Some streaming tests can take longer.
129 timeoutInterval
: 30000,