1 | # [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)
|
2 |
|
3 | > Run [Mocha](http://visionmedia.github.io/mocha/) tests
|
4 |
|
5 | *Keep in mind that this is just a thin wrapper around Mocha and your issue is most likely with Mocha.*
|
6 |
|
7 |
|
8 | ## Install
|
9 |
|
10 | Install with [npm](https://npmjs.org/package/gulp-mocha)
|
11 |
|
12 | ```
|
13 | npm install --save-dev gulp-mocha
|
14 | ```
|
15 |
|
16 |
|
17 | ## Example
|
18 |
|
19 | ```js
|
20 | var gulp = require('gulp');
|
21 | var mocha = require('gulp-mocha');
|
22 |
|
23 | gulp.task('default', function () {
|
24 | gulp.src('app.js')
|
25 | .pipe(mocha({ui: 'nyan'}));
|
26 | });
|
27 | ```
|
28 |
|
29 | ## API
|
30 |
|
31 | ### mocha(options)
|
32 |
|
33 |
|
34 | #### options.ui
|
35 |
|
36 | Type: `String`
|
37 | Default: `bdd`
|
38 | Values: `bdd`, `tdd`, `qunit`, `exports`
|
39 |
|
40 | The interface to use.
|
41 |
|
42 |
|
43 | #### options.reporter
|
44 |
|
45 | Type: `String`
|
46 | Default: `dot`
|
47 | Values: [reporters](https://github.com/visionmedia/mocha/tree/master/lib/reporters)
|
48 |
|
49 | The reporter that will be used.
|
50 |
|
51 | This option can also be used to utilize third-party reporters. For example if you `npm install mocha-lcov-reporter` you can then do use `mocha-lcov-reporter` as value.
|
52 |
|
53 |
|
54 | #### options.globals
|
55 |
|
56 | Type: `Array`
|
57 |
|
58 | Accepted globals.
|
59 |
|
60 |
|
61 | #### options.timeout
|
62 |
|
63 | Type: `Number`
|
64 | Default: `2000`
|
65 |
|
66 | Test-case timeout in milliseconds.
|
67 |
|
68 |
|
69 | #### options.bail
|
70 |
|
71 | Type: `Boolean`
|
72 | Default: `false`
|
73 |
|
74 | Bail on the first test failure.
|
75 |
|
76 |
|
77 | #### options.ignoreLeaks
|
78 |
|
79 | Type: `Boolean`
|
80 | Default: `false`
|
81 |
|
82 | Ignore global leaks.
|
83 |
|
84 |
|
85 | #### options.grep
|
86 |
|
87 | Type: `String`
|
88 |
|
89 | Only run tests matching the given pattern which is internally compiled to a RegExp.
|
90 |
|
91 |
|
92 | ## License
|
93 |
|
94 | MIT © [Sindre Sorhus](http://sindresorhus.com)
|