Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/quentinroy/jest-transform-pug
A Jest transform that compiles .pug files as template functions
https://github.com/quentinroy/jest-transform-pug
jest pug template transform
Last synced: about 1 month ago
JSON representation
A Jest transform that compiles .pug files as template functions
- Host: GitHub
- URL: https://github.com/quentinroy/jest-transform-pug
- Owner: QuentinRoy
- License: mit
- Created: 2018-02-22T09:52:37.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-04-23T04:22:41.000Z (7 months ago)
- Last Synced: 2024-05-19T18:22:08.148Z (6 months ago)
- Topics: jest, pug, template, transform
- Language: JavaScript
- Homepage:
- Size: 133 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# jest-transform-pug
[![NPM](https://img.shields.io/npm/v/jest-transform-pug.svg)](https://www.npmjs.com/package/jest-transform-pug)
[![dependencies Status](https://david-dm.org/QuentinRoy/jest-transform-pug/status.svg)](https://david-dm.org/QuentinRoy/jest-transform-pug)
[![devDependencies Status](https://david-dm.org/QuentinRoy/jest-transform-pug/dev-status.svg)](https://david-dm.org/QuentinRoy/jest-transform-pug?type=dev)A [Jest](https://github.com/facebook/jest) transform that compiles your
[.pug](https://github.com/pugjs/pug) files as template functions just like your
pug loader would (e.g [rollup-plugin-pug](https://github.com/aMarCruz/rollup-plugin-pug)
or [pug-loader](https://github.com/pugjs/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`:```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:```json
{
"jest": {
"transform": {
"^.+\\.jsx?$": "babel-jest",
"\\.(pug)$": "jest-transform-pug"
}
}
}
```