Skip to content

Instantly share code, notes, and snippets.

@crunchie84
Created April 18, 2013 09:28
Show Gist options
  • Save crunchie84/5411436 to your computer and use it in GitHub Desktop.
Save crunchie84/5411436 to your computer and use it in GitHub Desktop.
example configuration + proj setup of Karma (formerly known as Testacular) - see http://karma-runner.github.io/0.8/config/files.html for documentation
basePath = '';// base path, that will be used to resolve files and exclude
files = [
JASMINE, JASMINE_ADAPTER,
'js/libs/jquery-*.min.js',
// source files
'js/my-epic-menu.js',
//the tests (specs)
'tests/spec/**/*.js'
];
exclude = [];// list of files to exclude
preprocessors = {
'js/**/*.js': 'coverage' //generate symbols for coverage reporting
};
reporters = ['progress','junit','coverage'];//junit is required for teamcity integration
coverageReporter = {
type : 'cobertura',
dir : 'coverage/'
};//this will generate coverage\{browser}\cobertura-coverage.xml
port = 9876;// web server port
runnerPort = 9100;// cli runner port
colors = true;// enable / disable colors in the output (reporters and logs)
logLevel = LOG_DEBUG;//possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
// enable / disable watching file and executing tests whenever any file changes
autoWatch = false;//for single-run this is not important
singleRun = false;// if true, it capture browsers, run tests and exit (= for CI mode)
browsers = ['PhantomJS'];
captureTimeout = 60000;// If browser does not capture in given timeout [ms], kill it
describe('My Epic Menu Specs', function () {
/**
* This is a standard spec
* Testing the getters/setters is cumbersome but it shows how jasmine works
*/
describe('given a Menu instance', function () {
var menu;
beforeEach(function () {
menu = new MyEpicMenu();
});
it('should have a menu variable defined', function () {
expect(menu).toBeDefined();
});
it('and it should have 0 items', function () {
expect(text.items).toBe(0);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment