Run test on multiple browser within your editor!
This plugin allows to run your test suites with karma-runner inside Brackets IDE
##Installation
- Make sure you have
karma-cli
installed globally:npm install -g karma-cli
- Then install karma-brackets (and karma) and add them to your project dependencies:
npm install karma-brackets --save-dev
- Open Brackets > File > Extension Manager (or click on the icon on the sidebar)
- Select the "Available" tab
- Search for "karma" and press install
- Restart brackets
##Standalone Usage
- Add 'brackets' to the list of reporters in
karma.conf.js
- Open the configuration and (if needed) update the path to your karma executable
- Start karma server with
File > Start karma server
- Once the server is running the status bar will show a black 'K'
- You can now execute your tests with
File > launch tests
(Cmd/Ctrl + Alt + k
) - Bonus: If you enable auto-watch in
karma.conf.js
, you won't need the previous step :) - Enjoy Testing with karma and brackets!
##Using an external karma server (e.g. with grunt)
- Again, make sure karma.conf.js has 'brackets' in the list of reporters
- Connect to karma with
File > Connect to karma server
##Example config file This is how your config file should look like in order to use karma within brackets
module.exports = function (config) {
'use strict';
config.set({
basePath: '.',
files: [
'someFile.js',
'someFile.spec.js'
],
reporters: ['progress', 'brackets'],
frameworks: ['jasmine'],
port: 9876,
runnerPort: 9100,
colors: true,
autoWatch: true,
browsers: ['Chrome', 'PhantomJS'],
captureTimeout: 60000,
singleRun: false
});
};
##Settings
You can specify a different karma executable, configuration file, and when to open the results panel (always, when a test fails or never) by going to File > Karma Settings
You can also enjoy karma auto-watch feature by simply putting the autoWatch
variable to true
in karma config file.
##Troubleshooting
With the latest version of this plugin, error reported should be cleaner and easier to understand. If you have any problem, feel free to open an issue on github.
##To-do
Live testing, test-on-savePort the brackets reporter to the new (unstable) brackets reporter formatMake the extension work with external karma server- on error - go to line (needs karma modification)
##Contibution
Currently, this plugin is tested on Mac OSX 10.8. I don't have full-time access to windows machines, if you can help me with testing on win, let me know!
Please use this plugin, enjoy it and report back any problem you may have (including your wife yelling at you). If you find a bug, please, open an issue on github (or, if you have time, send a pull request!)
Note that this plugin use a slightly modified version of karma.
For any information, suggestion or if you happen to be in London and just want to have a beer: artoale@gmail.com
###Licence
The MIT Licence
Copyright (C) 2013 Alessandro Artoni
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.