Skip to content
This repository has been archived by the owner on Dec 24, 2017. It is now read-only.

silentroach/jest-babel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Babel preprocessor for Jest

Usage

Install the package:

$ npm install jest-babel --save-dev

Add preprocessor to your package.json:

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

If you want to transpile your dependencies, you can skip the key preprocessorIgnorePatterns.

Extending default config

By default babel will transform your code with this config:

{
  "stage": 2,
  "retainLines": true,
  "auxiliaryCommentBefore": "istanbul ignore next"
}

You can override or extend it with jest-babel section in your package.json:

{
  "jest-babel": {
    "stage": 1,
    "extensions": ["es6", "customext"]
  }
}

About

Simple Babel preprocessor for Jest

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published