All Projects → blakeembrey → Co Mocha

blakeembrey / Co Mocha

Licence: mit
Enable support for generators in Mocha tests

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Co Mocha

Sdk
Library for using Grafana' structures in Go programs and client for Grafana REST API.
Stars: ✭ 193 (-10.65%)
Mutual labels:  generator
Yarsk
Don't use this, use Create React App
Stars: ✭ 199 (-7.87%)
Mutual labels:  mocha
Vue Generate Component
Vue js component generator
Stars: ✭ 206 (-4.63%)
Mutual labels:  generator
Gpt Scrolls
A collaborative collection of open-source safe GPT-3 prompts that work well
Stars: ✭ 195 (-9.72%)
Mutual labels:  generator
Mocha Parallel Tests
Parallel test runner for mocha tests. Looking for maintainer.
Stars: ✭ 197 (-8.8%)
Mutual labels:  mocha
Fantasy Map Generator
Web application generating interactive and highly customizable maps
Stars: ✭ 2,802 (+1197.22%)
Mutual labels:  generator
Typed Scss Modules
🎁 Generate type definitions (.d.ts) for CSS Modules using SCSS
Stars: ✭ 192 (-11.11%)
Mutual labels:  generator
Pollinate
Template your base files and generate new projects from Git(Hub).
Stars: ✭ 213 (-1.39%)
Mutual labels:  generator
Apigcc
一个非侵入的api编译、收集、Rest文档生成工具。工具通过分析代码和注释,获取文档信息,生成RestDoc文档。
Stars: ✭ 198 (-8.33%)
Mutual labels:  generator
Root Cause
🔍 Root Cause is a tool for troubleshooting Puppeteer and Playwright tests. 🔎
Stars: ✭ 205 (-5.09%)
Mutual labels:  mocha
Feathers Vue
A boiler plate template using Feathers with Email Verification, Vue 2 with Server Side Rendering, stylus, scss, jade, babel, webpack, ES 6-8, login form, user authorization, and SEO
Stars: ✭ 195 (-9.72%)
Mutual labels:  mocha
Laravel Tournaments
Laravel Package that allows you to generate customizable tournaments trees.
Stars: ✭ 196 (-9.26%)
Mutual labels:  generator
Php Ulid
A PHP port of alizain/ulid with some minor improvements.
Stars: ✭ 203 (-6.02%)
Mutual labels:  generator
Mocha.parallel
Run async mocha specs in parallel
Stars: ✭ 194 (-10.19%)
Mutual labels:  mocha
Testdeck
Object oriented testing
Stars: ✭ 206 (-4.63%)
Mutual labels:  mocha
Pydbgen
Random dataframe and database table generator
Stars: ✭ 191 (-11.57%)
Mutual labels:  generator
Blades
Blazing fast dead simple static site generator
Stars: ✭ 201 (-6.94%)
Mutual labels:  generator
Generators
API Generator - instantly generate REST and GraphQL APIs (openapi (OAS) 3.0.0)
Stars: ✭ 213 (-1.39%)
Mutual labels:  generator
Generator Web Extension
Advanced WebExtension generator that creates everything you need to get started with cross-browser web-extension development.
Stars: ✭ 212 (-1.85%)
Mutual labels:  generator
Regressor
Generate specs for your rails application the easy way. Regressor generates model and controller specs based on validations, associations, enums, database, routes, callbacks. Use regressor to capture your rails application behaviour.
Stars: ✭ 204 (-5.56%)
Mutual labels:  generator

Co Mocha

NPM version NPM downloads Build status Test coverage Greenkeeper badge

Enable support for generators in Mocha tests using co.

Use the --harmony-generators flag when running node 0.11.x to access generator functions, or transpile your tests using traceur or regenerator.

Installation

npm install co-mocha --save-dev

Usage

Just require the module in your tests and start writing generators in your tests.

it('should do something', function * () {
  yield users.load(123)
})

Node

Install the module using npm install co-mocha --save-dev. Now just require the module to automatically monkey patch any available mocha instances. With mocha, you have multiple ways of requiring the module - add --require co-mocha to your mocha.opts or add require('co-mocha') inside your main test file.

If you need to monkey patch a different mocha instance you can use the library directly:

var mocha = require('mocha')
var coMocha = require('co-mocha')

coMocha(mocha)

<script> Tag

<script src="co-mocha.js"></script>

Including the browserified script will automatically patch window.Mocha. Just make sure you include it after mocha.js. If that is not possible the library exposes window.coMocha, which can be used (window.coMocha(window.Mocha)).

AMD

Same details as the script, but using AMD requires instead.

How It Works

The module monkey patches the Runnable.prototype.run method of mocha to enable generators. In contrast to other npm packages, co-mocha extends mocha at runtime - allowing you to use any compatible mocha version.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].