(config, env)
| 19 | * @returns {ConfigOptions} |
| 20 | */ |
| 21 | export function configureKarma(config, env) { |
| 22 | const headless = config.headless || Boolean(env.KARMA_HEADLESS) || false; |
| 23 | |
| 24 | /** @type {ConfigOptions} */ |
| 25 | const options = { |
| 26 | failOnFailingTestSuite: true, |
| 27 | failOnEmptyTestSuite: true, |
| 28 | basePath: '../..', |
| 29 | frameworks: ['jasmine'], |
| 30 | files: [ |
| 31 | 'tests/inject/support/customize.ts', |
| 32 | 'tests/inject/support/polyfills.ts', |
| 33 | {pattern: 'tests/inject/**/*.tests.ts', watched: false}, |
| 34 | ], |
| 35 | plugins: [ |
| 36 | 'karma-chrome-launcher', |
| 37 | 'karma-firefox-launcher', |
| 38 | process.platform === 'darwin' ? 'karma-safari-launcher' : null, |
| 39 | 'karma-rollup-preprocessor', |
| 40 | 'karma-jasmine', |
| 41 | 'karma-spec-reporter', |
| 42 | ].filter(Boolean), |
| 43 | preprocessors: { |
| 44 | '**/*.+(ts|tsx)': ['rollup'], |
| 45 | }, |
| 46 | rollupPreprocessor: { |
| 47 | plugins: [ |
| 48 | rollupPluginTypescript({ |
| 49 | rootDir: absolutePath('.'), |
| 50 | typescript, |
| 51 | outDir: 'build/tests', |
| 52 | tsconfig: absolutePath('tests/inject/tsconfig.json'), |
| 53 | cacheDir: `${fs.realpathSync(os.tmpdir())}/darkreader_typescript_test_cache`, |
| 54 | }), |
| 55 | rollupPluginReplace({ |
| 56 | preventAssignment: true, |
| 57 | __DEBUG__: false, |
| 58 | __FIREFOX_MV2__: false, |
| 59 | __CHROMIUM_MV2__: false, |
| 60 | __CHROMIUM_MV3__: false, |
| 61 | __THUNDERBIRD__: false, |
| 62 | __PLUS__: false, |
| 63 | __PORT__: '-1', |
| 64 | __TEST__: true, |
| 65 | __WATCH__: false, |
| 66 | }), |
| 67 | ], |
| 68 | output: { |
| 69 | dir: 'build/tests', |
| 70 | strict: true, |
| 71 | format: 'iife', |
| 72 | sourcemap: 'inline', |
| 73 | }, |
| 74 | }, |
| 75 | reporters: ['spec'], |
| 76 | port: 9876, |
| 77 | colors: true, |
| 78 | logLevel: config.LOG_INFO, |
nothing calls this directly
no test coverage detected