1 | [![Build Status](https://travis-ci.org/alansouzati/gulp-jest.svg?branch=master)](https://travis-ci.org/alansouzati/gulp-jest)
|
2 | [![Code Climate](https://codeclimate.com/github/alansouzati/gulp-jest/badges/gpa.svg)](https://codeclimate.com/github/alansouzati/gulp-jest)
|
3 | [![Test Coverage](https://codeclimate.com/github/alansouzati/gulp-jest/badges/coverage.svg)](https://codeclimate.com/github/alansouzati/gulp-jest/coverage)
|
4 |
|
5 | # [gulp](http://gulpjs.com)-jest
|
6 |
|
7 | Gulp plugin for the Jest test library
|
8 |
|
9 | ## Installation
|
10 |
|
11 | ```bash
|
12 | $ npm install gulp-jest jest-cli
|
13 | ```
|
14 |
|
15 | ## Usage
|
16 |
|
17 | ```javascript
|
18 | var jest = require('gulp-jest').default;
|
19 |
|
20 | gulp.task('jest', function () {
|
21 | return gulp.src('__tests__').pipe(jest({
|
22 | "preprocessorIgnorePatterns": [
|
23 | "<rootDir>/dist/", "<rootDir>/node_modules/"
|
24 | ],
|
25 | "automock": false
|
26 | }));
|
27 | });
|
28 |
|
29 | ```
|
30 |
|
31 | ## `process.env.NODE_ENV`
|
32 |
|
33 | Unlike the `jest` CLI tool, `gulp-jest` does not automatically set `process.env.NODE_ENV`
|
34 | to be `test`. If you are using Webpack or Babel, you may need to manually set `process.env.NODE_ENV`
|
35 | prior to running the task itself.
|
36 |
|
37 | ```javascript
|
38 | gulp.task('jest', function () {
|
39 | process.env.NODE_ENV = 'test';
|
40 |
|
41 | return gulp.src('__tests__').pipe(jest({
|
42 | ...
|
43 | }));
|
44 | });
|
45 | ```
|
46 |
|
47 | ## API
|
48 |
|
49 | ### jest(options)
|
50 |
|
51 | #### options
|
52 |
|
53 | as per [Jest config](http://facebook.github.io/jest/docs/configuration.html)
|
54 |
|
55 | ## License
|
56 |
|
57 | MIT © [Dominic Barker](http://www.dombarker.co.uk)
|