npm install gulp-jest-cli#### Using npm:
``sh`
$ npm install gulp-jest-cli jest-cli --save-dev
#### Using yarn:
`sh`
$ yarn add gulp-jest-cli jest-cli --dev
`js
import plugin from 'gulp-jest-cli';
gulp.task('jest', () => gulp
/*
* Jest's rootDir will be set to the directory specified in gulp.srcrootDir
* unless a is explicitly configured via configuration options`
*/
.src('src')
.pipe(plugin({
config: {
/ Configuration options /
{
coverageReporters: [
'text',
'text-summary',
'json',
'lcov',
],
collectCoverageFrom: [
'*/.js',
'!*/test*',
]
}
},
/ CLI options/
coverage: true,
onlyChanged: true,
}))
);
Jest docs for configuration options can be found here.
#### Configuration options via external file
`js
import plugin from 'gulp-jest-cli';
gulp.task('jest', () => gulp
.src('src')
.pipe(plugin({
config: '.jestrc',
/ CLI options /
coverage: true,
onlyChanged: true,
}))
);
`
#### Configuration options via package.json
`js
import plugin from 'gulp-jest-cli';
gulp.task('jest', () => gulp
.src('src')
.pipe(plugin({
/ Jest will fallback to package.json for configuration when config is omitted /
/ CLI options /
coverage: true,
onlyChanged: true,
}))
);
``
#### Questions?
Feel free to reach out to me on Twitter @jmurzy.
#### License
All pull requests that get merged will be made available under the MIT license, as the rest of the repository.