Skip to content

Instantly share code, notes, and snippets.

@bennett000
Created March 17, 2016 18:59
Show Gist options
  • Save bennett000/bdf4b58a6986ce91a416 to your computer and use it in GitHub Desktop.
Save bennett000/bdf4b58a6986ce91a416 to your computer and use it in GitHub Desktop.
// Karma configuration
// Generated on Tue Feb 04 2014 21:57:25 GMT-0500 (EST)
/*global module, require */
const path = require('path');
module.exports = function(config) {
'use strict';
config.set(
{
// enable / disable watching file and executing tests whenever any
// file changes
autoWatch: false,
// base path, that will be used to resolve files and exclude
basePath: '.',
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera (has to be installed with `npm install karma-opera-launcher`)
// - Safari (only Mac; has to be installed with `npm install
// karma-safari-launcher`)
// - PhantomJS
// - IE (only Windows; has to be installed with `npm install
// karma-ie-launcher`)
browsers: ['Firefox'], //, 'PhantomJS', 'Chrome'],
// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,
// enable / disable colors in the output (reporters and logs)
colors: true,
// coverage setup
coverageReporter: {
dir: 'coverage/',
reporters: [
{ type: 'html', subdir: 'report-html' },
{ type: 'lcov', subdir: 'report-lcov' },
{ type: 'cobertura', subdir: '.', file: 'cobertura.txt' },
{ type: 'lcovonly', subdir: '.', file: 'report-lcovonly.txt' },
{ type: 'teamcity', subdir: '.', file: 'teamcity.txt' },
{ type: 'text', subdir: '.', file: 'text.txt' },
{ type: 'text-summary', subdir: '.', file: 'text-summary.txt' }
]
},
// list of files to exclude
exclude: [],
files: [
'src/*.js'
],
// frameworks to use
frameworks: ['jasmine'],
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR ||
// config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_WARN,
plugins: [
require('karma-coverage'),
require('karma-firefox-launcher'),
require('karma-jasmine')
],
// web server port
port: 9876,
// coverage support
preprocessors: {
'src/**/*.js': ['coverage']
},
// test results reporter to use
// possible values: 'dots', 'progress', 'coverage'
reporters: ['progress', 'coverage'],
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false,
});
};
{
"name": "test-playground",
"version": "0.0.1",
"description": "Playground for experimenting with unit tests",
"main": "index.js",
"scripts": {
"test": "karma start --singleRun"
},
"author": "Rangle.io",
"license": "MIT",
"devDependencies": {
"jasmine-core": "^2.4.1",
"karma": "^0.13.22",
"karma-coverage": "^0.5.5",
"karma-firefox-launcher": "^0.1.7",
"karma-jasmine": "^0.3.8",
"karma-junit-reporter": "^0.4.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment