{"_id":"its-name","_rev":"4175169","name":"its-name","description":"Given (Mocha) test object, walks it up to give you list of context names","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"bahmutov","email":"gleb.bahmutov@gmail.com"}],"time":{"modified":"2026-03-01T21:29:34.000Z","created":"2017-08-18T19:03:17.160Z","1.0.0":"2017-08-18T19:03:17.160Z"},"users":{},"author":{"name":"Gleb Bahmutov","email":"gleb.bahmutov@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/bahmutov/its-name.git"},"versions":{"1.0.0":{"name":"its-name","description":"Given (Mocha) test object, walks it up to give you list of context names","version":"1.0.0","author":{"name":"Gleb Bahmutov","email":"gleb.bahmutov@gmail.com"},"bugs":{"url":"https://github.com/bahmutov/its-name/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 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/its-name#readme","keywords":["context","it","mocha","name","util"],"license":"MIT","main":"src/","publishConfig":{"registry":"http://registry.npmjs.org/"},"repository":{"type":"git","url":"git+https://github.com/bahmutov/its-name.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","semantic-release":"semantic-release pre && npm publish && semantic-release post"},"release":{"analyzeCommits":"simple-commit-message","generateNotes":"github-post-release","verifyRelease":{"path":"dont-crack","test-against":[]}},"devDependencies":{"ban-sensitive-files":"1.9.0","dependency-check":"2.9.1","deps-ok":"1.2.1","dont-crack":"1.2.1","git-issues":"1.3.1","github-post-release":"1.13.1","license-checker":"13.0.3","mocha":"3.5.0","nsp":"2.7.0","pre-git":"3.15.3","prettier-standard":"6.0.0","semantic-release":"7.0.2","simple-commit-message":"3.3.1","snap-shot-it":"2.1.0","standard":"10.0.3"},"gitHead":"876e024f51ba9f7b40fdbb96015af9653f612822","_id":"its-name@1.0.0","_shasum":"2065f1883ecb568c65f7112ddbf123401fae4af0","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.11.2","_npmUser":{"name":"bahmutov","email":"gleb.bahmutov@gmail.com"},"dist":{"shasum":"2065f1883ecb568c65f7112ddbf123401fae4af0","size":2817,"noattachment":false,"key":"/its-name/-/its-name-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/its-name/download/its-name-1.0.0.tgz"},"maintainers":[{"name":"bahmutov","email":"gleb.bahmutov@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/its-name-1.0.0.tgz_1503082996291_0.8514442974701524"},"directories":{},"publish_time":1503082997160,"_hasShrinkwrap":false,"_cnpm_publish_time":1503082997160,"_cnpmcore_publish_time":"2021-12-17T03:41:54.460Z"}},"readme":"# its-name\n\n> Given (Mocha) test object, walks it up to give you list of context names\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\n## Install\n\nRequires [Node](https://nodejs.org/en/) version 6 or above.\n\n```sh\nnpm install --save its-name\n```\n\n## Use\n\nIf you have a test instance, for example when running Mocha you can find\nthe list of names starting from the top level `describe` down to the test's\nown name. From inside test just pass `this` instance.\n\n```js\nconst itsName = require('its-name')\ndescribe('its-name', () => {\n  describe('nested describe', () => {\n    context('inner context', () => {\n      it('finds all names', function () {\n        const names = itsName(this)\n        // [\"its-name\", \"nested-describe\", \"inner context\", \"finds all names\"]\n      })\n    })\n  })\n})\n```\n\n**Note:** if the test instance is an arrow function - its context will NOT\nbe the test object, instead it will be the parent closure.\n\n```js\nconst itsName = require('its-name')\nit('works', function () {\n  itsName(this)\n  // [\"works\"]\n})\nit('does not work', () => {\n  itsName(this)\n  // throws an error\n})\n```\n\n### Small print\n\nAuthor: Gleb Bahmutov &lt;gleb.bahmutov@gmail.com&gt; &copy; 2017\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/its-name/issues) on Github\n\n## MIT License\n\nCopyright (c) 2017 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/its-name.svg?downloads=true\n[npm-url]: https://npmjs.org/package/its-name\n[ci-image]: https://travis-ci.org/bahmutov/its-name.svg?branch=master\n[ci-url]: https://travis-ci.org/bahmutov/its-name\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","_attachments":{},"homepage":"https://github.com/bahmutov/its-name#readme","bugs":{"url":"https://github.com/bahmutov/its-name/issues"},"license":"MIT"}