Skip to content

denar90/jest-nunjucks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

jest-nunjucks

Jest processor that compiles nunjucks templates

Install

npm i jest-nunjucks --save-dev

Config example

Add to your config

"jest": {
    "transform": {
        "^.+\\.njk$": "jest-nunjucks",
    }
}

To use nunjucks configuration options just add them into global jest config

"jest": {
  "globals": {
    "nunjucks": {
      "config": {
        "throwOnUndefined": true,
        "trimBlocks": true
      }
    }
  },
  "transform": {
    "^.+\\.njk$": "jest-nunjucks"
  }
}

To use set path to look for templates use root option, it will be resolved with jest <rootDir>. If it's unset path for templates will be - <rootDir>;

"jest": {
  "globals": {
    "nunjucks": {
      "root": "./path-to-root-dir",
      "config": {
        "throwOnUndefined": true,
        "trimBlocks": true
      }
    }
  },
  "transform": {
    "^.+\\.njk$": "jest-nunjucks"
  }
}

License

MIT

About

Jest processor that compiles nunjucks templates

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published