Skip to content

Instantly share code, notes, and snippets.

@xiankai
Last active May 19, 2016 12:13
Show Gist options
  • Save xiankai/b42e59f2f00317230e0b01304c93feb9 to your computer and use it in GitHub Desktop.
Save xiankai/b42e59f2f00317230e0b01304c93feb9 to your computer and use it in GitHub Desktop.
jspm karma config
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: 'webroot',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: [
'jspm',
'mocha',
'chai'
],
plugins: [
'karma-jspm',
'karma-mocha',
'karma-chai',
'karma-phantomjs-launcher',
'karma-nyan-reporter'
],
// unused
files: [
],
jspm: {
loadFiles: [
'components/**/tests/**/*.js', // location of test files
],
serveFiles: [
'components/**/*.js', // location of source files
'dev-bundle.js', // location of
],
config: 'jspm_packages/karma.js',
packages: 'jspm_packages/',
useBundles: true
},
proxies: {
},
// list of files to exclude
exclude: [
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['nyan'],
// 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_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['PhantomJS'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
})
}
{
"devDependencies": {
"chai": "^3.5.0",
"karma": "^0.13.22",
"karma-babel-preprocessor": "^6.0.1",
"karma-chai": "^0.1.0",
"karma-jspm": "^2.1.0",
"karma-mocha": "^0.2.2",
"karma-nyan-reporter": "^0.2.4",
"karma-phantomjs-launcher": "^1.0.0",
"mocha": "^2.4.5",
"phantomjs-prebuilt": "^2.1.7"
},
"scripts": {
"test": "cp webroot/jspm_packages/config.js webroot/jspm_packages/karma.js && sed -i -e 's/\"\\/\"/\"\"/' webroot/jspm_packages/karma.js && ./node_modules/karma/bin/karma start || true"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment