{"_id":"@code-dungeon/mocha-given","_rev":"2-ac87263a103891014ca18edda7e028a6","name":"@code-dungeon/mocha-given","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@code-dungeon/mocha-given","version":"0.0.1","description":"Adds a Given-When-Then DSL to mocha as an alternative style for specs","main":"./index.js","browser":"./browser/mocha-given.js","devDependencies":{"@code-dungeon/commit-format":"^0.0.2","coffeescript":"^2.6.1","expect.js":"~0.3.1","husky":"^7.0.4","istanbul":"^1.0.0-alpha.2","mocha":"^9.1.3","source-map-support":"^0.5.20"},"peerDependencies":{"mocha":">=9.1.3"},"config":{"cz-customizable":{"config":"commit-config.js"}},"scripts":{"coverage":"istanbul cover _mocha -- --config test/mocha_config.yml","check-coverage":"istanbul check-coverage --statement -5 --branch -3","prepare":"husky install .github/hooks","test":"mocha --config test/mocha_config.yml","link:modules":"./scripts/link.sh"},"keywords":["mocha","given","when","then","test","tdd","bdd"],"repository":{"type":"git","url":"git+https://github.com/code-deungeon/mocha-given.git"},"license":"MIT","gitHead":"849c98afb516cce0a98ab34db004fb4197d9558b","bugs":{"url":"https://github.com/code-deungeon/mocha-given/issues"},"homepage":"https://github.com/code-deungeon/mocha-given#readme","_id":"@code-dungeon/mocha-given@0.0.1","_nodeVersion":"14.17.0","_npmVersion":"6.14.13","dist":{"integrity":"sha512-IAyfXpsKbtD4LuHUdQ1YeyPvskyiMqPpl5M/yvQtYi6uy2s4VjvMEsQf8cfxg3MltHGBHc3TuXLyxO8XW3LiRw==","shasum":"d07bed99a4631058c56fd24033cb71da7c3be739","tarball":"https://registry.npmjs.org/@code-dungeon/mocha-given/-/mocha-given-0.0.1.tgz","fileCount":5,"unpackedSize":14687,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhzdAECRA9TVsSAnZWagAAPpcP+QH4oAS5GUO61tewZg47\njC5VhFMN4h9rUoEZgPegUQh0rBs6Tu6sDBAznaBvsrm9l+puMRoiWl51OBjr\n3i9XrJFwa0M7qEYN0FEaspV+GSQEiPg4GgIMuSHHiQ8I2fn0b327qnqoggdL\nFPI1zugFca9pfQyHCgWt/8/BSDH9oX7RKFJrpEXkXdTYmz6o0CAWdYD7CZQ1\nrvpikFVGTqYbAAnta5h3id/4u9baTLioqw2s6CSdeSu3TPZHUxe7tGXCk6WD\n3wbmxTzmEXLJeNzTz0rIvtWxXqbIsXaMz614ngjtyK9L7PxpCTQovrZAXZhF\nSlpn/IyrcVJ1jf4dgvYC3TqSMRiItQRXjDhSyGidk84keQUrvfAxKkj1lXpe\n2a0sTW4SeXZULkm0bistbDbbE/KfmhMio3/gMjjpOxSNibXWe8qV/w4skDGs\nq7W7DiS8pgLXkItVOnkmg2WxJWwCESx98lyBdPSA+BR6cHr/QP5YO18ag/Wg\nF9iCcxHUZE4sod6oY4BIsfHO8dTjShoFHiRgq/1OvzqW9/O29RCbh1IVH+y2\nhl3wv3yjV9JzaIGmKbCfNUO8ADCKT558/JH+q3ETLOH5cRzez0sMxF2d8+Xa\nB/I/xJUUaHcyZ+q//HJmRTQj61kxOrSPGMmU86TZ/n6BBaB/HizCJtF8M33r\nznNC\r\n=NmM1\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCLnfPM0vQCGhDQ+IZAYOAj0H+4DOwK2piMADo0IMb7TwIhAJZFDZvxD8dA68r4rebcEzZlJbe0wTdtpeE32NWar+zo"}]},"_npmUser":{"name":"joekallen","email":"joe.k.allen@gmail.com"},"directories":{},"maintainers":[{"name":"joekallen","email":"joe.k.allen@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mocha-given_0.0.1_1636648768339_0.8810990593142847"},"_hasShrinkwrap":false}},"time":{"created":"2021-11-11T16:39:28.291Z","0.0.1":"2021-11-11T16:39:28.475Z","modified":"2022-04-04T23:56:58.503Z"},"maintainers":[{"name":"joekallen","email":"joe.k.allen@gmail.com"}],"description":"Adds a Given-When-Then DSL to mocha as an alternative style for specs","homepage":"https://github.com/code-deungeon/mocha-given#readme","keywords":["mocha","given","when","then","test","tdd","bdd"],"repository":{"type":"git","url":"git+https://github.com/code-deungeon/mocha-given.git"},"bugs":{"url":"https://github.com/code-deungeon/mocha-given/issues"},"license":"MIT","readme":"# mocha-given\n\nMocha-given is a mocha interface that helps you write cleaner specs using `Given`, `When`, `Then` and `And`.\nIt is a shameless port of Justin Searls' [jasmine-given](https://github.com/searls/jasmine-given) which is a tribute to Jim Weirich's terrific [rspec-given](https://github.com/jimweirich/rspec-given) gem.\n\n## Example Specs\n\n``` coffeescript\ndescribe 'assigning stuff to this', ->\n\tGiven -> @number = 24\n\tWhen  -> @number++\n\tAnd   -> @number *= 2\n\tThen  -> @number == 50\n\ndescribe 'assigning stuff to variables', ->\n\tsubject = null\n\tGiven -> subject = []\n\tWhen  -> subject.push('foo')\n\tThen  -> subject.length == 1\n\ndescribe 'Testing deferred', ->\n\tGiven -> @t = Date.now()\n\tThen.after 1500, 'so much time has passed', -> Date.now() - @t >= 1500\n\ndescribe 'Testing async', ->\n\tGiven -> @subject = new User()\n\tThen 'save user', (done) -> @subject.save(done);\n```\n\n## Run tests\n\n### Global installation of mocha\n\nIf you have mocha installed globally you need to install mocha-given globally as well.\n```\n$ npm install -g mocha mocha-given\n```\nThen you can run your tests by setting the interface of mocha to mocha-given\n```\n$ mocha -u mocha-given --compilers coffee:coffee-script -R spec\n```\n### Local installation of mocha\n\nIf you have installed mocha and mocha-given locally\n```\n$ npm install mocha-given coffee-script\n```\nyou have to call the mocha binary directly:\n```\n$ ./node_modules/.bin/mocha -u mocha-given --compilers coffee:coffee-script -R spec\n```\n\n## Run mocha-given tests & start contributing\n\nTo run the `mocha-given` tests for developing, it has to be symlinked into the `node_modules` folder to enable `mocha` to resolve `mocha-given`.\n\nTherefore run the script:\n\n```\n$ npm run link\n```\n\nAfterwards `mocha` has to be installed with ` $ npm install mocha`.\n\nNow you can run the tests using `$ npm tests` and start contributing.\n\n## Run tests programmatically\n\n``` javascript\nvar Mocha = require('mocha');\nvar fs    = require('fs');\nvar path  = require('path');\n\n// require mocha-given after Mocha is set\nrequire('mocha-given');\n\n// the directory with your tests/specs\nvar testDir = 'tests';\n\n// First, you need to instantiate a Mocha instance.\nvar mocha = new Mocha({\n\tui: 'mocha-given',\n\treporter: 'spec'\n});\n\n// Get test files\nfs.readdirSync(testDir).filter(function(file){\n\t// allow javascript and coffescript files\n\treturn file.match(/\\.(coffee|js)$/);\n}).forEach(function(file){\n\tmocha.addFile(\n\t\tpath.join(testDir, file)\n\t);\n});\n\n// Now, you can run the tests.\nmocha.run(function(failures){\n  process.on('exit', function () {\n\tprocess.exit(failures);\n  });\n});\n```\n\nRun from command line (with mocha and mocha-given installed):\n\n```\n$ node runtests.js\n```\n\nCredits\n-------\n\nThanks to [SinnerSchrader](http://www.sinnerschrader.com/) for their support and the time to work on this project.\n","readmeFilename":"README.md"}