MENU
Karma
Alexa's Ranking: 478,453
Karma allows you to test your code on real browsers and real devices such as phones, tablets, or on a headless PhantomJS instance. With it, you can describe your tests with Mocha, Jasmine, QUnit, or write a simple adapter for any framework you like.
“Karma is essentially a tool that spawns a web server that executes source code against test code for each of the browsers connected. The results of each test against each browser are examined and displayed via the command line to the developer such that they can see which browsers and tests passed or failed.”
$ karma init my.conf.jsWhich testing framework do you want to use?Press tab to list possible options. Enter to move to the next question.> jasmineDo you want to use Require.js?This will add the Require.js plugin.Press tab to list possible options. Enter to move to the next question.> noDo you want to capture a browser automatically?Press tab to list possible options. Enter an empty string to move to the next question.> Chrome> Firefox>What is the location of your source and test files?You can use glob patterns, eg. "js/*.js" or "test/**/*Spec.js".Press Enter to move to the next question.> *.js> test/**/*.js>Should any of the files included by the previous patterns be excluded?You can use glob patterns, eg. "**/*.swp".Press Enter to move to the next question.>Do you want Karma to watch all the files and run the tests on change?Press tab to list possible options.> yesConfig file generated at "/Users/vojta/Code/karma/my.conf.js".
“The configuration file can be written in CoffeeScript as well. If you execute karma init with a *.coffee extension such as karma init karma.conf.coffee, it will generate a CoffeeScript file.
Of course, you can write the config file by hand or copy-paste it from another project ;-)
”
Karma can be extended through plugins.