Skip to content

Instantly share code, notes, and snippets.

@AVGP
Created January 21, 2015 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AVGP/1cebf55bab8de9c3d401 to your computer and use it in GitHub Desktop.
Save AVGP/1cebf55bab8de9c3d401 to your computer and use it in GitHub Desktop.
Karma sample
// js/app.js
function add(a, b) {
return a+b;
}
function say(text) {
document.body.textContent = text;
}
// test/app.test.js
describe("Test suite", function() {
it("can add stuff", function() {
expect(add(2,3)).toEqual(5)
});
it("can write things into the document", function() {
say("Ohai");
expect(document.body.textContent).toEqual("Ohai");
});
});
// Karma configuration
// Generated on Wed Jan 21 2015 19:14:41 GMT+0100 (CET)
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jasmine'],
files: [
'js/*.js',
'test/*.js'
],
exclude: [],
preprocessors: {},
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment