Coder Social home page Coder Social logo

gulp-jest-cli's Introduction

Gulp Jest CLI CircleCI npm version npm

Gulp plugin for Jest.

Installation

Using npm:

$ npm install gulp-jest-cli jest-cli --save-dev

Using yarn:

$ yarn add gulp-jest-cli jest-cli --dev

Usage

import plugin from 'gulp-jest-cli';

gulp.task('jest', () => gulp
  /*
   * Jest's `rootDir` will be set to the directory specified in `gulp.src`
   * unless a `rootDir` 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

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

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.

Contributing

Contributions are very welcome: bug fixes, features, documentation, tests. Just make sure the CI is ๐Ÿ‘Œ.

#### License All pull requests that get merged will be made available under [the MIT license](https://github.com/jmurzy/gulp-jest-cli/blob/master/LICENSE.md), as the rest of the repository.

gulp-jest-cli's People

Contributors

jmurzy avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

halfmatthalfcat

gulp-jest-cli's Issues

Incompatibility with Jest 20

When using gulp-jest-cli with Jest version 20+, an error occurs projects.map is not a function. This is due to runCLI expecting an array as the second argument.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.