// Karma configuration
module.exports = function(config) {
config.set({
// base path, that will be used to resolve files and exclude
basePath: '..',
// frameworks to use
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
"static/angular.js",
"static/angular-mocks.js",
//define-yesod-example.js sets up window.module so that the .js files in angular-app will work
"tests/unit-js/define-yesod-example.js",
"angular-app/*.js",
"angular-app/*.hamlet",
//If you had more than one module, you would include here another define-<modname>.js file
//and then the includes for the module itself as follows:
/*"tests/unit-js/define-anothermodule.js",
"anothermodule/*.js",
"anothermodule/*.hamlet",*/
// Now all the tests. We take advantage of the fact that karma will only
// load a file once as if it matched the first pattern, so
// define-yesod-example.js will not be included here a second time.
"tests/unit-js/*.js",
],
// Load all the karma plugins plus our custom plugin for hamlet.
// This includes all the builtin karma plugins plus the karma-ng-hamlet2js-preprocessor
// which converts hamlet files to javascript.
plugins: [
"karma-*",
],
// Set up hamlet to use the karma-ng-hamlet2js-preprocessor plugin
preprocessors: {
"**/*.hamlet" : ["ng-hamlet2js"],
},
//Custom options for the hamlet preprocessor. The preprocessor will use runghc to call
//hamletTestTemplate from the Yesod.EmbeddedStatic.AngularJavascript module. Since the
//tests here might run before this module has been installed, we pass an extra argument
//to runghc to tell runghc where to find the Yesod.EmbeddedStatic.AngularJavascript. In
//your own tests you won't need this.
ngHamlet2JsPreprocessor: {
extraGhcArgs: ["-i../../.."],
},
// list of files to exclude
exclude: [
"**/*.swp"
],
// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
reporters: ['progress'],
// 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, 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'],
// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false
});
};