-
Notifications
You must be signed in to change notification settings - Fork 1
/
package.json
executable file
·49 lines (49 loc) · 5.93 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{
"name": "grunt-karma",
"version": "0.6.2",
"description": "grunt plugin for karma test runner",
"main": "tasks/grunt-karma.js",
"repository": {
"type": "git",
"url": "https://github.com/karma-runner/grunt-karma.git"
},
"keywords": [
"gruntplugin",
"karma",
"grunt",
"test",
"unit",
"runner",
"TDD"
],
"scripts": {
"test": "grunt test"
},
"author": {
"name": "Dave Geddes"
},
"license": "MIT",
"readmeFilename": "README.md",
"dependencies": {
"optimist": "~0.6.0"
},
"devDependencies": {
"grunt": "~0.4.1",
"expect.js": "~0.2.0",
"grunt-release": "~0.5.1",
"grunt-contrib-watch": "~0.2.0",
"grunt-conventional-changelog": "~0.0.12",
"karma-mocha": "~0.1.0"
},
"peerDependencies": {
"grunt": "0.4.x",
"karma": "~0.10.0"
},
"readme": "#grunt-karma\nGrunt plugin for [Karma](https://github.com/karma-runner/karma)\nNOTE: this plugin requires Grunt 0.4.x\n\n##Getting Started\nFrom the same directory as your project's Gruntfile and package.json, install this plugin with the following command:\n\n`npm install grunt-karma --save-dev`\n\nNote that even numbered minor releases follow Karma's stable channel, while odd numbers follow the unstable channel. So grunt-karma@0.6.x goes with karma@0.10.x, while grunt-karma@0.7.x goes with karma@0.11.x\n\nOnce that's done, add this line to your project's Gruntfile:\n\n```js\ngrunt.loadNpmTasks('grunt-karma');\n```\n\n##Config\nInside your `Gruntfile.js` file, add a section named *karma*, containing any number of configurations for running karma. You can either put your config in a [karma config file](http://karma-runner.github.com/0.8/config/configuration-file.html) or leave it all in your Gruntfile (recommended). \n\n###Here's an example that points to the config file:\n\n```js\nkarma: {\n unit: {\n configFile: 'karma.conf.js'\n }\n}\n```\n\n###Here's an example that puts the config in the Gruntfile:\n\n```js\nkarma: {\n unit: {\n options: {\n files: ['test/**/*.js']\n }\n }\n}\n```\n\nYou can override any of the config file's settings by putting them directly in the Gruntfile:\n\n```js\nkarma: {\n unit: {\n configFile: 'karma.conf.js',\n runnerPort: 9999,\n singleRun: true,\n browsers: ['PhantomJS']\n }\n}\n```\n\n##Sharing Configs\nIf you have multiple targets, it may be helpful to share common configuration settings between them. Grunt-karma supports this by using the `options` property:\n\n```js\nkarma: {\n options: {\n configFile: 'karma.conf.js',\n runnerPort: 9999,\n browsers: ['Chrome', 'Firefox']\n },\n continuous: {\n singleRun: true,\n browsers: ['PhantomJS']\n },\n dev: {\n reporters: 'dots'\n }\n}\n```\n\nIn this example the `continuous` and `dev` targets will both use the `configFile` and `runnerPort` specified in the `options`. But the `continuous` target will override the browser setting to use PhantomJS, and also run as a singleRun. The `dev` target will simply change the reporter to dots.\n\n##Running tests\nThere are three ways to run your tests with karma:\n\n###Karma Server with Auto Runs on File Change\nSetting the `autoWatch` option to true will instruct karma to start a server and watch for changes to files, running tests automatically:\n\n```js\nkarma: {\n unit: {\n configFile: 'karma.conf.js',\n autoWatch: true\n }\n}\n```\nNow run `$ grunt karma`\n\n###Karma Server with Grunt Watch\nMany Grunt projects watch several types of files using [grunt-contrib-watch](https://github.com/gruntjs/grunt-contrib-watch).\nConfig karma like usual (without the autoWatch option), and add `background:true`:\n\n```js\nkarma: {\n unit: {\n configFile: 'karma.conf.js',\n background: true\n }\n}\n```\nThe `background` option will tell grunt to run karma in a child process so it doesn't block subsequent grunt tasks.\n\nConfig your `watch` task to run the karma task with the `:run` flag. For example:\n\n```js\nwatch: {\n //run unit tests with karma (server needs to be already running)\n karma: {\n files: ['app/js/**/*.js', 'test/browser/**/*.js'],\n tasks: ['karma:unit:run'] //NOTE the :run flag\n }\n},\n```\n\nIn your terminal window run `$ grunt karma:unit watch`, which runs both the karma task and the watch task. Now when grunt watch detects a change to one of your watched files, it will run the tests specified in the `unit` target using the already running karma server. This is the preferred method for development.\n\n###Single Run\nKeeping a browser window & karma server running during development is productive, but not a good solution for build processes. For that reason karma provides a \"continuous integration\" mode, which will launch the specified browser(s), run the tests, and close the browser(s). It also supports running tests in [PhantomJS](http://phantomjs.org/), a headless webkit browser which is great for running tests as part of a build. To run tests in continous integration mode just add the `singleRun` option:\n\n```js\nkarma: {\n unit: {\n configFile: 'config/karma.conf.js',\n },\n //continuous integration mode: run tests once in PhantomJS browser.\n continuous: {\n configFile: 'config/karma.conf.js',\n singleRun: true,\n browsers: ['PhantomJS']\n },\n}\n```\n\nThe build would then run `grunt karma:continuous` to start PhantomJS, run tests, and close PhantomJS.\n\n##Grep / Passing Options to Karma Adapters\nAny cli args will be automatically parsed and sent on to adapters in the `config.args` property. So for example to use Mocha's useful `grep` feature, run grunt-karma like so: \n\n```\ngrunt karma:dev watch --grep=mypattern\n```\n\nNote that adapters like [karma-mocha](https://github.com/karma-runner/karma-mocha) have to support the args you're wanting to pass to them.\n\n##License\nMIT License\n",
"bugs": {
"url": "https://github.com/karma-runner/grunt-karma/issues"
},
"homepage": "https://github.com/karma-runner/grunt-karma",
"_id": "grunt-karma@0.6.2",
"_from": "grunt-karma@"
}