{"id":21451466,"url":"https://github.com/db-developer/grunt-nyc-mocha","last_synced_at":"2026-03-05T23:39:26.082Z","repository":{"id":57255505,"uuid":"317016903","full_name":"db-developer/grunt-nyc-mocha","owner":"db-developer","description":"run mocha tests and generate coverage reports with nyc","archived":false,"fork":false,"pushed_at":"2024-07-01T19:37:26.000Z","size":559,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-17T15:11:38.526Z","etag":null,"topics":["coverage","grunt","javascript","mocha","nyc","plugin","testing"],"latest_commit_sha":null,"homepage":"https://www.slashlib.org/?page_id=477","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/db-developer.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"docs/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-11-29T18:31:33.000Z","updated_at":"2024-07-01T19:37:15.000Z","dependencies_parsed_at":"2023-01-30T01:45:52.198Z","dependency_job_id":"2cb9ef03-b9ca-4969-9333-93dd6119fb0a","html_url":"https://github.com/db-developer/grunt-nyc-mocha","commit_stats":{"total_commits":112,"total_committers":1,"mean_commits":112.0,"dds":0.0,"last_synced_commit":"828e91396513ad5776855df8cdfccabb8e0b74a8"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/db-developer%2Fgrunt-nyc-mocha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/db-developer%2Fgrunt-nyc-mocha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/db-developer%2Fgrunt-nyc-mocha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/db-developer%2Fgrunt-nyc-mocha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/db-developer","download_url":"https://codeload.github.com/db-developer/grunt-nyc-mocha/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225999652,"owners_count":17557627,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coverage","grunt","javascript","mocha","nyc","plugin","testing"],"created_at":"2024-11-23T04:22:15.911Z","updated_at":"2026-03-05T23:39:21.056Z","avatar_url":"https://github.com/db-developer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# grunt-nyc-mocha #\n\ngrunt task for running tests and coverage, based on nyc and mocha.\n\n[![npm version](https://img.shields.io/npm/v/grunt-nyc-mocha?color=blue)](https://www.npmjs.com/package/grunt-nyc-mocha)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![jsdoc](https://img.shields.io/static/v1?label=jsdoc\u0026message=%20api%20\u0026color=blue)](https://jsdoc.app/)\n[![Built with Grunt](https://cdn.gruntjs.com/builtwith.svg)](https://gruntjs.com/)\n[![codecov](https://codecov.io/gh/db-developer/grunt-nyc-mocha/branch/master/graph/badge.svg)](https://codecov.io/gh/db-developer/grunt-nyc-mocha)\n[![Build Status](https://travis-ci.com/db-developer/grunt-nyc-mocha.svg?branch=master)](https://travis-ci.com/db-developer/grunt-nyc-mocha)\n[![dependencies](https://img.shields.io/librariesio/release/npm/grunt-nyc-mocha)](https://libraries.io/)\n\n## content ##\n\n* Usage\n  * [Getting started guide (see 'getting started' below)](#getting-started)\n  * [Reference of all available options](docs/options.md)\n  * [Sourcemap support](docs/sourcemapsupport.md)\n\n* Developers\n  * [Testing grunt-nyc-mocha](docs/grunt.md#testing)\n  * [Code coverage of tests for grunt-nyc-mocha](docs/grunt.md#code-coverage)\n  * [Build grunt-nyc-mocha from scratch](docs/grunt.md#building)\n  * [Frameworks used for building and running grunt-nyc-mocha](docs/frameworks.md)\n  * [API of package grunt-nyc-mocha](docs/api.index.md)\n\n[Changelog](CHANGELOG.md)\n\n## getting started ##\n\nThis guide assumes, that you are familiar with the use of [npm](https://npmjs.com \"Homepage of npm\") and [grunt](https://gruntjs.com \"Homepage of grunt\").  \nThe plugin can be installed by the following command:\n\n\u003ccode\u003enpm install grunt-nyc-mocha --save-dev\u003c/code\u003e\n\nOnce installed, the plugin may be loaded from within your gruntfile.\n\n### task nyc_mocha ###\n\n\"nyc_mocha\" is a grunt multitask provided by \u003ccode\u003egrunt-nyc-mocha\u003c/code\u003e and\ncan hold multiple targets. Each of the targets you may define will spawn\ntheir very own node process.\n\nMultitask configuration generally splits into the following parts:\n\n* [options (tasklevel, inherited by any target)](docs/options.md)\n* target (0 to n)\n  * any other grunt configuration properties\n  * [options (targetlevel, will be merged into tasklevel options)](docs/options.md)\n\nAny target can extend, repeat or overwrite options previously defined by a task.\nFor doing so, each target can specify its own \"options\" property. Targetlevel\noptions will be merged into tasklevel options, overwriting them.\n\n### raw usage of \u003ccode\u003egrunt-nyc-mocha\u003c/code\u003e ###\n\n```javascript\n// extract from gruntfile.js\n\nmodule.exports = function( grunt ) {\n  grunt.initConfig({\n    // among many others ...\n    nyc_mocha:{\n      options: { /*tasklevel options go here*/ }\n      target:  {\n        src: \"./src/test/**/*.spec.js\", // test suites to run...\n        options: { /* targetlevel options go here */ }\n      }\n    }\n  });\n\n  grunt.loadNpmTasks( \"nyc_mocha\" );\n\n  grunt.registerTask( \"default\", [ \"nyc_mocha:target\" ]);\n}\n```\n\n### using \u003ccode\u003egrunt-nyc-mocha\u003c/code\u003e with \u003ccode\u003eload-grunt-config\u003c/code\u003e and \u003ccode\u003eload-grunt-tasks\u003c/code\u003e ###\n\nInstall the following packages:  \n\u003ccode\u003enpm install load-grunt-config --save-dev\u003c/code\u003e  \n\u003ccode\u003enpm install load-grunt-tasks  --save-dev\u003c/code\u003e  \n\nNow you can split gruntfile.js in multiple configuration files:\n\n```javascript\n// extract from (a much cleaner) gruntfile.js\nconst configPath = ...? // this is where your config files reside\nconst data       = { /* some properties, that can be passed on */ };\n\nmodule.exports = function( grunt ) {\n  require( \"load-grunt-config\" )( grunt, { configPath, data });\n  require( \"load-grunt-tasks\"  )( grunt );\n\n  grunt.registerTask( \"default\", [ \"nyc_mocha:target\" ]);\n}\n```\n\n```javascript\n// extract from nyc_mocha.js (has to be named tasklike!)\nmodule.exports = function ( grunt, options ) {\n  return {\n    target: {\n      src: \"./src/test/**/*.spec.js\", // run those test files\n      options: {\n        nyc: {\n          coverage: {                                 // report nyc coverage results\n            dir:          \"dist/coverage\",            // ... to folder\n            reporter:     [ \"html\", \"text-summary\" ]  // ... using reporters\n          },\n          excludes:       [ \"**/*.spec.js\" ],         // exclude test files from instrumentation!\n          requires:       [ \"grunt-nyc-mocha/scripts/sourcemapsupport\" ]\n        },\n        mocha: {\n          color:          true                        // force colored output\n        }\n      }\n    }\n  }\n};\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdb-developer%2Fgrunt-nyc-mocha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdb-developer%2Fgrunt-nyc-mocha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdb-developer%2Fgrunt-nyc-mocha/lists"}