1 | # gulp-jasmine [](https://travis-ci.org/sindresorhus/gulp-jasmine)
|
2 |
|
3 | > Run [Jasmine 2](https://jasmine.github.io/index.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
|
18 | const gulp = require('gulp');
|
19 | const jasmine = require('gulp-jasmine');
|
20 |
|
21 | gulp.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 |
|
37 | Type: `boolean`<br>
|
38 | Default: `false`
|
39 |
|
40 | Display spec names in default reporter.
|
41 |
|
42 | ##### includeStackTrace
|
43 |
|
44 | Type: `boolean`<br>
|
45 | Default: `false`
|
46 |
|
47 | Include stack traces in failures in default reporter.
|
48 |
|
49 | ##### reporter
|
50 |
|
51 | Type: `Object` `Object[]`
|
52 |
|
53 | Reporters to use.
|
54 |
|
55 | ```js
|
56 | const gulp = require('gulp');
|
57 | const jasmine = require('gulp-jasmine');
|
58 | const reporters = require('jasmine-reporters');
|
59 |
|
60 | gulp.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 |
|
72 | Type: `number`<br>
|
73 | Default `5000`
|
74 |
|
75 | Time to wait in milliseconds before a test automatically fails.
|
76 |
|
77 | ##### errorOnFail
|
78 |
|
79 | Type: `boolean`<br>
|
80 | Default: `true`
|
81 |
|
82 | Stops the stream on failed tests.
|
83 |
|
84 | ##### config
|
85 |
|
86 | Type: `Object`
|
87 |
|
88 | Passes the config to Jasmine's [loadConfig](https://jasmine.github.io/2.8/node.html#section-Load_configuration_from_a_file_or_from_an_object.) method.
|
89 |
|
90 | #### events
|
91 |
|
92 | ##### jasmineDone
|
93 |
|
94 | Emitted 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 |
|
100 | Add `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 |
|
105 | MIT © [Sindre Sorhus](https://sindresorhus.com)
|