Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
library karma config
var tsconfig = require('./tsconfig.json');
// set global environment variable CHROME_BIN=chromium-browser
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['mocha', 'chai', 'sinon-chai', 'chai-as-promised', 'karma-typescript'],
files: [
'src-test/**/*.ts',
'node_modules/jquery/dist/jquery.js',
'node_modules/angular/angular.js',
'node_modules/angular-i18n/angular-locale_en.js',
'node_modules/angular-i18n/angular-locale_fr.js',
{ pattern: 'src/**/*.ts', served: true, included: true }
],
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress', 'karma-typescript' ],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'src/**/*.ts': ['karma-typescript'],
'src-test/**/*.ts': ['karma-typescript']
},
karmaTypescriptConfig: {
compilerOptions: {
target: 'ES5',
module: 'commonjs',
sourceMap: true,
inlineSources: true,
declaration: true,
allowSyntheticDefaultImports: true,
emitDecoratorMetadata: true,
experimentalDecorators: true,
moduleResolution: 'node',
baseUrl: '.',
paths: {
'ot/*': ['./src/*'],
},
exclude: ["node_modules", "dist",]
},
reports: {
'lcovonly': 'test_reports/coverage',
'html': 'test_reports/html',
'text-summary': ''
},
coverageOptions: {
exclude: /\.(d|Spec)\.ts?/,
},
bundlerOptions: {
transforms: [
require('karma-typescript-es6-transform')()
],
entrypoints: /\Spec\.ts$/,
resolve: {
directories: ['node_modules']
}
}
},
plugins: [
require('karma-mocha'),
require('karma-chai'),
require('karma-chai-plugins'),
require('karma-coverage'),
require('karma-chrome-launcher'),
require('karma-typescript'),
require('karma-typescript-es6-transform'),
require('karma-firefox-launcher'),
require('karma-sinon-chai'),
],
port: 9876, // karma web server port
colors: true,
logLevel: config.LOG_INFO,
browsers: ['ChromeHeadless','Chrome'],
autoWatch: false,
singleRun: true, // Karma captures browsers, runs the tests and exits
concurrency: Infinity,
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.