{"id":19545413,"url":"https://github.com/forter/few-mocha","last_synced_at":"2025-04-26T19:31:59.412Z","repository":{"id":57234874,"uuid":"50576102","full_name":"forter/few-mocha","owner":"forter","description":"Enable support for generators in mocha tests using few","archived":false,"fork":false,"pushed_at":"2023-03-21T19:32:28.000Z","size":7,"stargazers_count":3,"open_issues_count":2,"forks_count":2,"subscribers_count":54,"default_branch":"master","last_synced_at":"2025-04-18T23:54:21.753Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/forter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-28T10:43:20.000Z","updated_at":"2016-03-17T12:31:06.000Z","dependencies_parsed_at":"2022-08-23T15:50:36.601Z","dependency_job_id":null,"html_url":"https://github.com/forter/few-mocha","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forter%2Ffew-mocha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forter%2Ffew-mocha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forter%2Ffew-mocha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forter%2Ffew-mocha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/forter","download_url":"https://codeload.github.com/forter/few-mocha/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251041479,"owners_count":21527203,"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":[],"created_at":"2024-11-11T03:38:34.364Z","updated_at":"2025-04-26T19:31:59.056Z","avatar_url":"https://github.com/forter.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Few Mocha\n\n[![Build status](https://travis-ci.org/forter/few-mocha.svg?branch=master)](https://travis-ci.org/forter/few-mocha)\n\nEnable support for generators in [Mocha](https://github.com/mochajs/mocha) tests using [few](https://github.com/forter/few).\n\n## Installation\n\n```\nnpm install few-mocha --save-dev\n```\n\n## Usage\n\nSimply require the module and start writing generators in your tests.\n\n```js\ndescribe(\"New user\", function() {\n  let business;\n  let user;\n\n  before(function*() {\n    yield setup();\n    business = yield Account.create(\"FooBar Inc\");\n    user = yield business.addUser(\"Mr. Boo\");\n  });\n\n  it(\"should be the only customer\", function*() {\n    let count = yield User.count({ businessID: business.id });\n    assert.equal(count, 1);\n  });\n\n  after(function*() {\n    yield cleanUp();\n  });\n});\n```\n\n### Node\n\nInstall the module using `npm install few-mocha --save-dev`. With `mocha`, you have multiple ways of requiring the module:\n- add `--require few-mocha` to your `mocha.opts`\n- add `require('few-mocha')` inside your main test file.\n\nIf you need to add generator support to a different mocha instance you can use it like this:\n\n```js\nvar mocha = require('mocha')\nvar fewMocha = require('few-mocha')\n\nfewMocha(mocha)\n```\n\n## How It Works\n\nThe module override the `Runnable.prototype.run` method of `mocha` to enable generators. In contrast to other npm packages, `few-mocha` extends `mocha` at runtime.\n\n## License\nLicensed under Apache 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforter%2Ffew-mocha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fforter%2Ffew-mocha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforter%2Ffew-mocha/lists"}