{"_id":"has-only","_rev":"4175168","name":"has-only","description":"Tells if the current Mocha execution is running only some tests that use .only","dist-tags":{"latest":"1.1.1"},"maintainers":[{"name":"bahmutov","email":"gleb.bahmutov@gmail.com"}],"time":{"modified":"2026-03-01T21:29:33.000Z","created":"2018-03-13T03:35:37.361Z","1.1.1":"2018-05-04T19:05:19.716Z","1.1.0":"2018-05-04T18:58:52.461Z","1.0.0":"2018-03-13T03:35:37.361Z"},"users":{},"author":{"name":"Gleb Bahmutov","email":"gleb.bahmutov@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/bahmutov/has-only.git"},"versions":{"1.1.1":{"name":"has-only","description":"Tells if the current Mocha execution is running only some tests that use .only","version":"1.1.1","author":{"name":"Gleb Bahmutov","email":"gleb.bahmutov@gmail.com"},"bugs":{"url":"https://github.com/bahmutov/has-only/issues"},"config":{"pre-git":{"commit-msg":"simple","pre-commit":["npm prune","npm run deps","npm test","git add src/*.js","npm run ban"],"pre-push":["npm run unused-deps","npm run secure","npm run license","npm run ban -- --all","npm run size"],"post-commit":[],"post-merge":[]}},"engines":{"node":">=6"},"files":["src/*.js","!src/*-spec.js"],"homepage":"https://github.com/bahmutov/has-only#readme","keywords":["mocha","only","test","utility"],"license":"MIT","main":"src/","private":false,"publishConfig":{"registry":"http://registry.npmjs.org/"},"repository":{"type":"git","url":"git+https://github.com/bahmutov/has-only.git"},"scripts":{"ban":"ban","deps":"deps-ok && dependency-check --no-dev .","issues":"git-issues","license":"license-checker --production --onlyunknown --csv","lint":"standard --verbose --fix src/*.js","prelint":"npm run pretty","pretest":"npm run lint","pretty":"prettier-standard 'src/*.js'","secure":"nsp check","size":"t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";","test":"npm run unit","unit":"mocha src/*-spec.js","unused-deps":"dependency-check --unused --no-dev .","semantic-release":"semantic-release","travis-deploy-once":"travis-deploy-once"},"release":{"analyzeCommits":"simple-commit-message"},"devDependencies":{"ban-sensitive-files":"1.9.2","dependency-check":"3.1.0","deps-ok":"1.4.1","execa-wrap":"1.4.0","git-issues":"1.3.1","lazy-ass":"1.6.0","license-checker":"16.0.0","mocha":"5.1.1","nsp":"3.2.1","pre-git":"3.17.1","prettier-standard":"8.0.1","semantic-release":"15.2.0","simple-commit-message":"4.0.3","standard":"11.0.1","travis-deploy-once":"4.4.1"},"gitHead":"f0b3aa0ce8e628fa33a44577b8348170753ad5f7","_id":"has-only@1.1.1","_npmVersion":"5.6.0","_nodeVersion":"8.11.1","_npmUser":{"name":"bahmutov","email":"gleb.bahmutov@gmail.com"},"dist":{"shasum":"0ed2b101e73a2226254421464c65e381affcce66","size":3266,"noattachment":false,"key":"/has-only/-/has-only-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/has-only/download/has-only-1.1.1.tgz"},"maintainers":[{"name":"bahmutov","email":"gleb.bahmutov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/has-only_1.1.1_1525460719581_0.45950082455222385"},"_hasShrinkwrap":false,"publish_time":1525460719716,"_cnpm_publish_time":1525460719716,"_cnpmcore_publish_time":"2021-12-17T03:41:54.512Z"},"1.1.0":{"name":"has-only","description":"Tells if the current Mocha execution is running only some tests that use .only","version":"1.1.0","author":{"name":"Gleb Bahmutov","email":"gleb.bahmutov@gmail.com"},"bugs":{"url":"https://github.com/bahmutov/has-only/issues"},"config":{"pre-git":{"commit-msg":"simple","pre-commit":["npm prune","npm run deps","npm test","git add src/*.js","npm run ban"],"pre-push":["npm run unused-deps","npm run secure","npm run license","npm run ban -- --all","npm run size"],"post-commit":[],"post-merge":[]}},"engines":{"node":">=6"},"files":["src/*.js","!src/*-spec.js"],"homepage":"https://github.com/bahmutov/has-only#readme","keywords":["mocha","only","test","utility"],"license":"MIT","main":"src/","private":false,"publishConfig":{"registry":"http://registry.npmjs.org/"},"repository":{"type":"git","url":"git+https://github.com/bahmutov/has-only.git"},"scripts":{"ban":"ban","deps":"deps-ok && dependency-check --no-dev .","issues":"git-issues","license":"license-checker --production --onlyunknown --csv","lint":"standard --verbose --fix src/*.js","prelint":"npm run pretty","pretest":"npm run lint","pretty":"prettier-standard 'src/*.js'","secure":"nsp check","size":"t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";","test":"npm run unit","unit":"mocha src/*-spec.js","unused-deps":"dependency-check --unused --no-dev .","semantic-release":"semantic-release","travis-deploy-once":"travis-deploy-once"},"release":{"analyzeCommits":"simple-commit-message"},"devDependencies":{"ban-sensitive-files":"1.9.2","dependency-check":"3.1.0","deps-ok":"1.4.1","execa-wrap":"1.4.0","git-issues":"1.3.1","lazy-ass":"1.6.0","license-checker":"16.0.0","mocha":"5.1.1","nsp":"3.2.1","pre-git":"3.17.1","prettier-standard":"8.0.1","semantic-release":"15.2.0","simple-commit-message":"4.0.3","standard":"11.0.1","travis-deploy-once":"4.4.1"},"gitHead":"cd5ed7725b0fdf05d0af26978a5185254b12152a","_id":"has-only@1.1.0","_npmVersion":"5.6.0","_nodeVersion":"8.11.1","_npmUser":{"name":"bahmutov","email":"gleb.bahmutov@gmail.com"},"dist":{"shasum":"67d0c87b8025da956036a82a81b3c4a9bab3322d","size":3284,"noattachment":false,"key":"/has-only/-/has-only-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/has-only/download/has-only-1.1.0.tgz"},"maintainers":[{"name":"bahmutov","email":"gleb.bahmutov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/has-only_1.1.0_1525460332374_0.6946192495611434"},"_hasShrinkwrap":false,"publish_time":1525460332461,"_cnpm_publish_time":1525460332461,"_cnpmcore_publish_time":"2021-12-17T03:41:54.813Z"},"1.0.0":{"name":"has-only","description":"Tells if the current Mocha execution is running only some tests that use .only","version":"1.0.0","author":{"name":"Gleb Bahmutov","email":"gleb.bahmutov@gmail.com"},"bugs":{"url":"https://github.com/bahmutov/has-only/issues"},"config":{"pre-git":{"commit-msg":"simple","pre-commit":["npm prune","npm run deps","npm test","git add src/*.js","npm run ban"],"pre-push":["npm run unused-deps","npm run secure","npm run license","npm run ban -- --all","npm run size"],"post-commit":[],"post-merge":[]}},"engines":{"node":">=6"},"files":["src/*.js","!src/*-spec.js"],"homepage":"https://github.com/bahmutov/has-only#readme","keywords":["mocha","only","test","utility"],"license":"MIT","main":"src/","private":false,"publishConfig":{"registry":"http://registry.npmjs.org/"},"repository":{"type":"git","url":"git+https://github.com/bahmutov/has-only.git"},"scripts":{"ban":"ban","deps":"deps-ok && dependency-check --no-dev .","issues":"git-issues","license":"license-checker --production --onlyunknown --csv","lint":"standard --verbose --fix src/*.js","prelint":"npm run pretty","pretest":"npm run lint","pretty":"prettier-standard 'src/*.js'","secure":"nsp check","size":"t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";","test":"npm run unit","unit":"mocha src/*-spec.js","unused-deps":"dependency-check --unused --no-dev .","semantic-release":"semantic-release","travis-deploy-once":"travis-deploy-once"},"release":{"analyzeCommits":"simple-commit-message"},"devDependencies":{"ban-sensitive-files":"1.9.2","dependency-check":"3.1.0","deps-ok":"1.2.2","execa-wrap":"1.2.1","git-issues":"1.3.1","lazy-ass":"1.6.0","license-checker":"16.0.0","mocha":"5.0.4","nsp":"3.2.1","pre-git":"3.17.0","prettier-standard":"8.0.0","semantic-release":"^15.0.2","simple-commit-message":"4.0.3","standard":"11.0.0","travis-deploy-once":"^4.4.0"},"gitHead":"9611471f31284ec753048f1e1d8f38075a1b7e59","_id":"has-only@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.10.0","_npmUser":{"name":"bahmutov","email":"gleb.bahmutov@gmail.com"},"dist":{"shasum":"d2d1fbeaece36bdc75aa55a97eeb5dbff3e9c7a1","size":2911,"noattachment":false,"key":"/has-only/-/has-only-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/has-only/download/has-only-1.0.0.tgz"},"maintainers":[{"name":"bahmutov","email":"gleb.bahmutov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/has-only_1.0.0_1520912137295_0.004983062394019022"},"_hasShrinkwrap":false,"publish_time":1520912137361,"_cnpm_publish_time":1520912137361,"_cnpmcore_publish_time":"2021-12-17T03:41:55.167Z"}},"readme":"# has-only\n\n> Tells if the current Mocha execution is running only some tests that use .only\n\n[![NPM][npm-icon] ][npm-url]\n\n[![Build status][ci-image] ][ci-url]\n[![semantic-release][semantic-image] ][semantic-url]\n[![js-standard-style][standard-image]][standard-url]\n[![renovate-app badge][renovate-badge]][renovate-app]\n\n## Install\n\nRequires [Node](https://nodejs.org/en/) version 6 or above.\n\n```sh\nnpm install --save-dev has-only\n```\n\n## Use\n\n### `hasOnly`\n\nPass current context or test. Returns true or false.\n\n```js\nconst {hasOnly} = require('has-only')\nbeforeEach(function () {\n  if (hasOnly(this)) {\n    // a test is using it.only\n    // or maybe a suite is using describe.only\n    // to exclude other tests\n  }\n})\n```\n\n### `hasFailed`\n\nPass current context or test. Returns true if some test or hook ran and failed.\n\n```js\nconst {hasFailed} = require('has-only')\nafter(function () {\n  if (hasFailed(this)) {\n    // some test or hook (like before, beforeEach, afterEach, after)\n    // has failed\n  }\n})\n```\n\n## Related\n\n* [its-name](https://github.com/bahmutov/its-name) walks from the current context up the chain to give you list of context names\n\n### Small print\n\nAuthor: Gleb Bahmutov &lt;gleb.bahmutov@gmail.com&gt; &copy; 2018\n\n* [@bahmutov](https://twitter.com/bahmutov)\n* [glebbahmutov.com](https://glebbahmutov.com)\n* [blog](https://glebbahmutov.com/blog)\n\nLicense: MIT - do anything with the code, but don't blame me if it does not work.\n\nSupport: if you find any problems with this module, email / tweet /\n[open issue](https://github.com/bahmutov/has-only/issues) on Github\n\n## MIT License\n\nCopyright (c) 2018 Gleb Bahmutov &lt;gleb.bahmutov@gmail.com&gt;\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\n[npm-icon]: https://nodei.co/npm/has-only.svg?downloads=true\n[npm-url]: https://npmjs.org/package/has-only\n[ci-image]: https://travis-ci.org/bahmutov/has-only.svg?branch=master\n[ci-url]: https://travis-ci.org/bahmutov/has-only\n[semantic-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg\n[semantic-url]: https://github.com/semantic-release/semantic-release\n[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg\n[standard-url]: http://standardjs.com/\n[renovate-badge]: https://img.shields.io/badge/renovate-app-blue.svg\n[renovate-app]: https://renovateapp.com/\n","_attachments":{},"homepage":"https://github.com/bahmutov/has-only#readme","bugs":{"url":"https://github.com/bahmutov/has-only/issues"},"license":"MIT"}