hansent / babel-jest

Jest plugin for Babel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

babel-jest

Babel jest plugin

Usage

Make the following changes to package.json:

{
  "devDependencies": {
    "babel-jest": "*",
    "jest-cli": "*"
  },
  "scripts": {
    "test": "jest"
  },
  "jest": {
    "scriptPreprocessor": "<rootDir>/node_modules/babel-jest",
    "testFileExtensions": ["es6", "js"],
    "moduleFileExtensions": ["js", "json", "es6"]
  }
}

And run:

$ npm install

And you're good to go!

Using experimental stages

By default, babel-jest will use Babel's default stage (stage 2). If you'd like to use one of the other stages, set the environment variable:

BABEL_JEST_STAGE

And then you can modify the test command in package.json like so:

{

  // Normal package.json stuff

  "scripts": {
    "test": "BABEL_JEST_STAGE=0 jest"
  },

  // Normal package.json stuff
}

About

Jest plugin for Babel

License:MIT License


Languages

Language:JavaScript 100.0%