Mimosa module for kicking of your test suite against real browsers - whenever you make changes to your code!
npm install mimosa-karma-enterprise
|2||downloads in the last week|
|4||downloads in the last month|
|Version||0.0.1 last updated 3 months ago|
|Keywords||mimosa, mmodule, karma, karma-runner, auto-watch, testing|
|Dependencies (14)||karma-jasmine, karma-requirejs, karma-coffee-preprocessor, karma-html2js-preprocessor, karma-chrome-launcher, karma-firefox-launcher, karma-phantomjs-launcher, karma-script-launcher, karma, karma-mocha, karma-coverage, karma-junit-reporter, karma-chai, karma-ng-html2js-preprocessor|
This is a Mimosa module for starting up a Karma test suite alongside Mimosa. This enables mimosa to give you instant feedback on your tests whenever your code changes.
For more information regarding Mimosa, see http://mimosajs.com
For more information regarding Karma, see http://karma-runner.github.io/
'mimosa-karma' to your list of modules. Mimosa will install the module for you when you start up.
There are two approaches for configuring Karma, either run
karma init or you can tweak your mimosa config.
To configure Karma with
karma init, run
karma init karma.conf.js. This will ask you a few questions and generate a config file for Karma named karma.conf.js.
If you prefer all your configuration to be in one place however, you can alternatively use your mimosa config file, adding the relevant configuration under a section named karma. The following link shows an example of how you can specify your karma configuration in Mimosa's config file eliminating the need for karma.conf.js: https://github.com/CraigCav/mimosa-karma/tree/master/example.
Example Usage using karma init
From the command prompt:
Which testing framework do you want to use?
Do you want to use Require.js?
Do you want to capture a browser automatically?
Which files do you want to include with
Which files do you want to test?
Any files you want to exclude?
Do you want Karma to watch all the files and run the tests on change?
Config file generated at "C:\Code\mimosa-new\karma.conf.js"
In the above example we have a folder in the root of our Mimosa application called tests. Tests contains two files: a spec file
test/example-view.spec.js which describes the functionality of
test/main.js which is a file that configures RequireJS for loading the test suite. See http://karma-runner.github.io/0.8/plus/RequireJS.html for more details about configuring RequireJS with Karma.
Now open up the mimosa config file (e.g. mimosa-config.coffee) and mark that we wish to use an external karma configuration:
karma: configFile: 'karma.conf.js' externalConfig: true
Now run mimosa watch as usual. You should see the karma output whenever you save changes to a file. e.g.:
'Chrome 26.0 (Windows): Executed 1 of 1 SUCCESS (0.138 secs / 0.006 secs)'
mimosa-karma module will spin up a karma server whenever running
mimosa watch --server, it will then let karma watch your configured list of files/and folders for changes and will then run your test suite.
karma: configFile: 'karma.conf.js' externalConfig: false basePath: '' autoWatch: true
configFile: Optional path to an external karma configuration file, see: http://karma-runner.github.io/0.8/config/configuration-file.html. If an external karma configuration file is used, no other settings are needed.
externalConfig: Denotes whether or not an external karma configuration file is used, the default is false.
basePath: Base path that will be used to resolve all relative paths defined under files or exclude sections. The default is an empty string.
autoWatch: Enable or disable executing the tests whenever a watched file changes. The default is true (autowatch enabled).
files: List of files/patterns/adapters for karma to load in the browser.
autoWatch: Enable or disable executing the tests whenever one of these files changes.
browsers: A list of browsers to launch and capture. Once Karma is shut down, it will shut down these browsers as well. You can capture any browser manually just by opening a url, where Karma's web server is listening.Currently available: Chrome, ChromeCanary, Firefox, Opera, Safari (only Mac), PhantomJS, IE (only Windows).