-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
54 lines (54 loc) · 6.69 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
50
51
52
53
54
{
"name": "grunt-karma",
"version": "0.9.0",
"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": {
"lodash": "~2.4.1"
},
"devDependencies": {
"grunt": "~0.4.3",
"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.3",
"karma": "~0.12.0",
"karma-firefox-launcher": "~0.1.3",
"karma-chrome-launcher": "~0.1.2"
},
"peerDependencies": {
"grunt": "0.4.x",
"karma": "~0.12.0"
},
"readme": "# grunt-karma [![Build Status](https://travis-ci.org/karma-runner/grunt-karma.svg?branch=master)](https://travis-ci.org/karma-runner/grunt-karma)\n\n> Grunt plugin for [Karma](https://github.com/karma-runner/karma)\n\nThis current version `0.8.0` uses `karma@0.12.x`. For using older versions see the\nold releases of grunt-karma.\n\n## Getting Started\nFrom the same directory as your project's Gruntfile and package.json, install\nthis plugin with the following command:\n\n```bash\n$ npm install grunt-karma --save-dev\n```\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\nany number of configurations for running karma. You can either put your\nconfig in a [karma config file] 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\ndirectly in the Gruntfile:\n\n```js\nkarma: {\n unit: {\n configFile: 'karma.conf.js',\n runnerPort: 9999,\n singleRun: true,\n browsers: ['PhantomJS'],\n logLevel: 'ERROR'\n }\n}\n```\n\nTo change the `logLevel` in the grunt config file instead of the karma config, use one of the following strings:\n`OFF`, `ERROR`, `WARN`, `INFO`, `DEBUG`\n\n### Config with Grunt Template Strings in `files`\n\nWhen using template strings in the `files` option, the results will flattened. Therefore, if you include a variable that includes an array, the array will be flattened before being passed to Karma.\n\nExample:\n\n```js\nmeta: {\n jsFiles: ['jquery.js','angular.js']\n},\nkarma: {\n options: {\n files: ['<%= meta.jsFiles %>','angular-mocks.js','**/*-spec.js']\n }\n}\n```\n\n## Sharing Configs\nIf you have multiple targets, it may be helpful to share common\nconfiguration settings between them. Grunt-karma supports this by\nusing 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\nthe `configFile` and `runnerPort` specified in the `options`. But\nthe `continuous` target will override the browser setting to use\nPhantomJS, and also run as a singleRun. The `dev` target will simply\nchange 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\na 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].\nConfig karma like usual (without the autoWatch option), and add\n`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\nso 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:start watch`, which starts the\nkarma server and the watch task. Now when grunt watch detects a change to\none of your watched files, it will run the tests specified in the `unit`\ntarget using the already running karma server. This is the preferred method\nfor development.\n\n### Single Run\nKeeping a browser window & karma server running during development is\nproductive, but not a good solution for build processes. For that reason karma\nprovides a \"continuous integration\" mode, which will launch the specified\nbrowser(s), run the tests, and close the browser(s). It also supports running\ntests in [PhantomJS], 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,\nrun tests, and close PhantomJS.\n\n## Using additional client.args\nYou can pass arbitrary `client.args` through the commandline like this:\n\n```bash\n$ grunt karma:dev watch --grep=mypattern\n```\n\n\n## License\nMIT License\n\n[karma-config-file]: http://karma-runner.github.com/0.8/config/configuration-file.html\n[grunt-contrib-watch]: https://github.com/gruntjs/grunt-contrib-watch\n[PhantomJS]: http://phantomjs.org/\n[karma-mocha]: https://github.com/karma-runner/karma-mocha\n",
"bugs": {
"url": "https://github.com/karma-runner/grunt-karma/issues"
},
"homepage": "https://github.com/karma-runner/grunt-karma",
"_id": "grunt-karma@0.9.0",
"_shasum": "de3d6ac478ffca350e729f3457457d5b0910e96b",
"_from": "grunt-karma@",
"_resolved": "https://registry.npmjs.org/grunt-karma/-/grunt-karma-0.9.0.tgz"
}