gherkin-jest icon indicating copy to clipboard operation
gherkin-jest copied to clipboard

Adding your own preprocessor config

Open wordyallen opened this issue 7 years ago • 3 comments

Maybe add an example of adding your own preprocessor config to the docs ?

preproccesor.js:


module.exports = require('babel-jest').createTransformer({
  "plugins": ["transform-es2015-modules-commonjs"]
});

package.json:


  "jest": {
    "transform": {
      "^.+\\.js$": "<rootDir>/preprocessor.js",
      "^.+\\.feature$": "gherkin-jest"
    },

wordyallen avatar Dec 29 '17 22:12 wordyallen

What does this do?

sjmeverett avatar Jan 08 '18 14:01 sjmeverett

updated syntax

    transform: {
      "^.+\\.js$": "babel-jest",
      "^.+\\.feature$": "gherkin-jest"
    },
  • Allows non.feature file tests written in babel to run parallel to feature

fullstackwebdev avatar Feb 25 '19 03:02 fullstackwebdev

I agree that this would be helpful. It took me a while to figure out why babel stopped working for my other tests after adding the transform for gherkin-jest.

noahrc avatar May 07 '19 22:05 noahrc