Skip to content

Instantly share code, notes, and snippets.

@ds82
Created June 28, 2016 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ds82/2eaeae875eef92481bc699ead8a7ac5c to your computer and use it in GitHub Desktop.
Save ds82/2eaeae875eef92481bc699ead8a7ac5c to your computer and use it in GitHub Desktop.
karma config
'use strict';
var aliasify = require('aliasify');
var makeAliasifyConfig = require('./aliasify.js');
var aliasifyConfig = makeAliasifyConfig();
aliasifyConfig.aliases['rea.templates'] = './tests/fixtures/rea-templates.js';
var stringify = require('stringify');
var stringifyConfig = require('./stringify');
//require('util').debuglog is not supported by node v0.10.45
//tsify uses debuglog -> workaround
require('util').debuglog = require('debuglog');
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '.',
plugins: [
'karma-browserify',
'karma-jasmine',
'karma-chrome-launcher'
],
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: [
'browserify',
'jasmine'
],
// list of files / patterns to load in the browser
files: [
'typings/index.d.ts',
'node_modules/reflect-metadata/Reflect.js',
{pattern: 'node_modules/reflect-metadata/Reflect.js.map', included: false, served: true},
'node_modules/jquery/dist/jquery.js',
'node_modules/angular/angular.js',
'node_modules/angular-mocks/angular-mocks.js',
{pattern: 'node_modules/angular-i18n/angular-locale_en-us.js', included: false, served: true},
'app/**/*.spec.ts',
'app/**/*.spec.js',
'tests/spec/**/*.spec.*'
],
proxies: {
'/dist/i18n/': '/base/node_modules/angular-i18n/'
},
// list of files to exclude
exclude: [
'app/**/node_modules/**/*.js'
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'app/**/*.spec.ts': ['browserify'],
'app/**/*.spec.js': ['browserify'],
'tests/spec/**/*.spec.*': ['browserify']
},
browserify: {
debug: true,
bundleDelay: 2500,
extensions: ['.js', '.ts'],
transform: [
[stringify(stringifyConfig.extensions), {global: true}],
['babelify', {ignore: /\.ts$/}],
[aliasify, aliasifyConfig]
],
plugin: [
['tsify', {target: 'es5', module: undefined, outDir: undefined}],
['proxyquireify/plugin', {global: true}]
]
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
// reporters: ['progress', 'html'],
reporters: ['progress'],
// the default configuration
htmlReporter: {
outputDir: 'build/karma_html',
templatePath: 'node_modules/karma-html-reporter/jasmine_template.html'
},
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR ||
// config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_DEBUG,
// logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
autoWatchBatchDelay: 2500,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment