UNPKG

2.17 kBMarkdownView Raw
1# gulp-jasmine [![Build Status](https://travis-ci.org/sindresorhus/gulp-jasmine.svg?branch=master)](https://travis-ci.org/sindresorhus/gulp-jasmine)
2
3> Run [Jasmine 2](http://jasmine.github.io/2.4/introduction.html) tests in Node.js
4
5*Issues with the output should be reported on the Jasmine [issue tracker](https://github.com/jasmine/jasmine/issues).*
6
7
8## Install
9
10```
11$ npm install --save-dev gulp-jasmine
12```
13
14
15## Usage
16
17```js
18const gulp = require('gulp');
19const jasmine = require('gulp-jasmine');
20
21gulp.task('default', () =>
22 gulp.src('spec/test.js')
23 // gulp-jasmine works on filepaths so you can't have any plugins before it
24 .pipe(jasmine())
25);
26```
27
28
29## API
30
31### jasmine([options])
32
33#### options
34
35##### verbose
36
37Type: `boolean`<br>
38Default: `false`
39
40Display spec names in default reporter.
41
42##### includeStackTrace
43
44Type: `boolean`<br>
45Default: `false`
46
47Include stack traces in failures in default reporter.
48
49##### reporter
50
51Type: `object`, `array` of `objects`
52
53Reporters to use.
54
55```js
56const gulp = require('gulp');
57const jasmine = require('gulp-jasmine');
58const reporters = require('jasmine-reporters');
59
60gulp.task('default', () =>
61 gulp.src('spec/test.js')
62 .pipe(jasmine({
63 reporter: new reporters.JUnitXmlReporter()
64 }))
65);
66```
67
68[Creating your own reporter.](http://jasmine.github.io/2.4/custom_reporter.html)
69
70##### timeout
71
72Type: `number`<br>
73Default `5000`
74
75Time to wait in milliseconds before a test automatically fails.
76
77##### errorOnFail
78
79Type: `boolean`<br>
80Default: `true`
81
82Stops the stream on failed tests.
83
84##### config
85
86Type: `object`
87
88Passes the config to Jasmine's [loadConfig](http://jasmine.github.io/2.4/node.html#section-Load_configuration_from_a_file_or_from_an_object.) method.
89
90#### events
91
92##### jasmineDone
93
94Emitted after all tests have been completed. For a discussion about why `jasmineDone` and not `end` nor `finish`, see [pull request #71](https://github.com/sindresorhus/gulp-jasmine/pull/71).
95
96## FAQ
97
98### Babel
99
100Add `require('babel-core/register');` to the top of your `gulpfile.js`. Make sure to read the [Babel docs](https://babeljs.io/docs/usage/require/).
101
102
103## License
104
105MIT © [Sindre Sorhus](http://sindresorhus.com)