You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
5.2 KiB

{
"name": "grunt-istanbul",
"description": "JavaScript codecoverage tool for Grunt",
"version": "0.3.0",
"homepage": "https://github.com/taichi/grunt-istanbul",
"author": {
"name": "taichi",
"email": "ryushi@gmail.com",
"url": "https://twitter.com/ryushi"
},
"contributors": [
{
"name": "Matthew Andrews",
"email": "matthew@andrews.eu.com"
},
{
"name": "Ryan Miller",
"email": "rmiller@marinsoftware.com"
},
{
"name": "rowanbeentje",
"email": "rowan@beent.je"
}
],
"repository": {
"type": "git",
"url": "git://github.com/taichi/grunt-istanbul.git"
},
"bugs": {
"url": "https://github.com/taichi/grunt-istanbul/issues"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/taichi/grunt-istanbul/blob/master/LICENSE-MIT"
}
],
"main": "Gruntfile.js",
"bin": {
"grunt-istanbul": "bin/grunt-istanbul"
},
"engines": {
"node": "~0.10.0"
},
"scripts": {
"test": "grunt test"
},
"dependencies": {
"istanbul": "~0.2.3",
"nue": "0.7.0-dev"
},
"peerDependencies": {
"grunt": "~0.4.5"
},
"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-nodeunit": "~0.4.0",
"grunt-contrib-clean": "~0.4.0a",
"mkdirp": "~0.3.4",
"rimraf": "~2.0.2",
"dateformat": "~1.0.3-1.2.3"
},
"keywords": [
"gruntplugin",
"coverage",
"code coverage",
"JS code coverage",
"JS coverage",
"istanbul"
],
"readme": "# grunt-istanbul [![Build Status](https://travis-ci.org/taichi/grunt-istanbul.png)](https://travis-ci.org/taichi/grunt-istanbul)\r\n\r\nJavaScript codecoverage tool for Grunt\r\n\r\n## Getting Started\r\nThis plugin requires Grunt ~0.4.1\r\n\r\nInstall this grunt plugin next to your project's [Gruntfile.js][getting_started] with: `npm install grunt-istanbul`\r\n\r\nThen add this line to your project's `Gruntfile.js` gruntfile:\r\n\r\n```javascript\r\ngrunt.loadNpmTasks('grunt-istanbul');\r\n```\r\n\r\n[grunt]: https://github.com/cowboy/grunt\r\n[getting_started]: https://github.com/cowboy/grunt/blob/master/docs/getting_started.md\r\n\r\n## Documentation\r\nTo use this grunt-istanbul plugin, register a grunt task to run the following:\r\n\r\n1. Instrument your source code\r\n2. Run your test suite against your instrumented source code\r\n3. Store your coverage results\r\n4. Make the report\r\n\r\nFor step 2, an environment variable can be used to determine which path to use for loading\r\nthe source code to run the tests against. For example, when you normally run your tests you\r\nwant them to point directly at your source code. But when you run your instanbul code coverage\r\ntask you want your tests to point at your instrumented source code. The `grunt-env` plugin\r\ncan be used for setting an environment variable in a grunt task. Here's an example solution\r\nthat solves this problem using `grunt-env` and `grunt-mocha-test`:\r\n\r\n```javascript\r\n// in Gruntfile.js\r\nmodule.exports = function (grunt) {\r\n\r\n grunt.initConfig({\r\n env: {\r\n coverage: {\r\n APP_DIR_FOR_CODE_COVERAGE: '../test/coverage/instrument/app/'\r\n }\r\n },\r\n instrument: {\r\n files: 'app/*.js',\r\n options: {\r\n lazy: true,\r\n basePath: 'test/coverage/instrument/'\r\n }\r\n },\r\n mochaTest: {\r\n options: {\r\n reporter: 'spec'\r\n },\r\n src: ['test/*.js']\r\n },\r\n storeCoverage: {\r\n options: {\r\n dir: 'test/coverage/reports'\r\n }\r\n },\r\n makeReport: {\r\n src: 'test/coverage/reports/**/*.json',\r\n options: {\r\n type: 'lcov',\r\n dir: 'test/coverage/reports',\r\n print: 'detail'\r\n }\r\n }\r\n });\r\n\r\n grunt.registerTask('coverage', ['env:coverage', 'instrument', 'mochaTest',\r\n 'storeCoverage', 'makeReport']);\r\n};\r\n\r\n\r\n// require_helper.js\r\nmodule.exports = function (path) {\r\n return require((process.env.APP_DIR_FOR_CODE_COVERAGE || '../app/') + path);\r\n};\r\n\r\n// using requireHelper in a test\r\nvar requireHelper = require('../require_helper');\r\nvar formValidator = requireHelper('form_validator');\r\n```\r\n\r\nAlso, checkout the example Gruntfile.js in this repo (note that you do not need to implement the\r\n`reloadTasks` task in this example):\r\n[Gruntfile.js](https://github.com/taichi/grunt-istanbul/blob/master/Gruntfile.js#69)\r\n\r\n### more examples\r\n\r\n* [Testing and Code Coverage With Node.js Apps](http://www.gregjopa.com/2014/02/testing-and-code-coverage-with-node-js-apps/)\r\n * [gregjopa/express-app-testing-demo](https://github.com/gregjopa/express-app-testing-demo)\r\n\r\n## Contributing\r\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt][grunt].\r\n\r\n## Release History\r\n_(Nothing yet)_\r\n\r\n## License\r\nCopyright (c) 2014 taichi\r\nLicensed under the MIT license.\r\n",
"readmeFilename": "README.md",
"_id": "grunt-istanbul@0.3.0",
"_shasum": "663166d06dd7f598e42cc702e8a6cc116ebc810d",
"_from": "grunt-istanbul@",
"_resolved": "https://registry.npmjs.org/grunt-istanbul/-/grunt-istanbul-0.3.0.tgz"
}