1.0.0 • Published 2 months ago

jest-transform-pug v1.0.0

Weekly downloads
475
License
MIT
Repository
github
Last release
2 months ago

jest-transform-pug

NPM dependencies Status devDependencies Status

A Jest transform that compiles your .pug files as template functions just like your pug loader would (e.g rollup-plugin-pug or pug-loader).

Usage

npm install jest-transform-pug --save-dev

Setup

Define jest-transform-pug as a transformer for Jest, by adding the following to your Jest configuration in your package.json:

{
  "jest": {
    "transform": {
      "\\.(pug)$": "jest-transform-pug"
    }
  }
}

Warning, this would override default transforms automatically set up by jest. Hence, if you rely on e.g., babel transpilation in your tests, you will need to set up babel jest as well:

{
  "jest": {
    "transform": {
      "^.+\\.jsx?$": "babel-jest",
      "\\.(pug)$": "jest-transform-pug"
    }
  }
}