gulp-mocha-co
Advanced tools
Comparing version 0.4.1-co.1 to 0.4.1-co.2
{ | ||
"name": "gulp-mocha-co", | ||
"version": "0.4.1-co.1", | ||
"version": "0.4.1-co.2", | ||
"description": "Run Mocha tests with co generators", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -1,17 +0,32 @@ | ||
# [gulp](https://github.com/wearefractal/gulp)-mocha [![Build Status](https://secure.travis-ci.org/sindresorhus/gulp-mocha.png?branch=master)](http://travis-ci.org/sindresorhus/gulp-mocha) | ||
## Information | ||
> Run [Mocha](http://visionmedia.github.io/mocha/) tests | ||
This gulp plugin is based on Sindre Sorhus gulp-mocha plugin, but pointing to [mocha-co](https://www.npmjs.org/package/mocha-co) | ||
*Keep in mind that this is just a thin wrapper around Mocha and your issue is most likely with Mocha.* | ||
## Use | ||
In order to have your tests running with mocha-co you need to launch gulp with the ES6 flag '--harmony' | ||
You can do it with | ||
```` | ||
node --harmony `which gulp` | ||
```` | ||
or creating an alias | ||
```` | ||
alias gulp='node --harmony `which gulp`' | ||
```` | ||
Then you can run your tasks as normal | ||
```` | ||
gulp test | ||
```` | ||
## Install | ||
Install with [npm](https://npmjs.org/package/gulp-mocha) | ||
Install with [npm](https://npmjs.org/package/gulp-mocha-co) | ||
``` | ||
npm install --save-dev gulp-mocha | ||
npm install --save-dev gulp-mocha-co | ||
``` | ||
## Example | ||
@@ -21,10 +36,32 @@ | ||
var gulp = require('gulp'); | ||
var mocha = require('gulp-mocha'); | ||
var mocha = require('gulp-mocha-co'); | ||
gulp.task('default', function () { | ||
gulp.src('test.js') | ||
.pipe(mocha({reporter: 'nyan'})); | ||
gulp.src('test.js') | ||
.pipe(mocha({reporter: 'nyan'})); | ||
}); | ||
``` | ||
## Code with generators | ||
```js | ||
describe('My test with generators', function(){ | ||
before(function *(){ | ||
yield whatever.doSomething() | ||
}); | ||
beforeEach(function(){ | ||
var returnedThing = yield whatever.returnWhatever() | ||
}); | ||
it('Should have the things', function*(){ | ||
var thingsExist = yield parser.checkIfThingsExist(); | ||
expect(thingsExist).to.equals(true); | ||
}); | ||
}); | ||
``` | ||
## API | ||
@@ -94,3 +131,3 @@ | ||
## License | ||
Based on Sindre Sorhus work | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) |
3775
132