Created
October 12, 2015 19:27
-
-
Save grndrth/e739883687b14f8b060b to your computer and use it in GitHub Desktop.
Setting up Karma with Mocha, Chai, Babel, CommonJS. Everything else in karma.conf.js can be left at standard settings.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Karma configuration | |
module.exports = function(config) { | |
config.set({ | |
// base path that will be used to resolve all patterns (eg. files, exclude) | |
basePath: '', | |
// frameworks to use | |
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter | |
frameworks: ['chai', 'mocha', 'commonjs'], | |
// list of files / patterns to load in the browser | |
files: [ | |
'path/to/code/**/*.js' | |
], | |
// 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: { | |
'path/to/code/**/*.js': ['babel', 'sourcemap', 'commonjs'] | |
}, | |
babelPreprocessor: { | |
options: { | |
sourceMap: 'inline' | |
} | |
}, | |
// [....] | |
plugins: [ | |
"karma-mocha", | |
"karma-chai", | |
"karma-commonjs", | |
"karma-babel-preprocessor", | |
"karma-sourcemap-loader" | |
], | |
// [....] | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment