nghtml2js-jest

Jest preprocessor to turn Angular 1 templates into JS and put in modules.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
nghtml2js-jest
1.0.25 years ago5 years agoMinified + gzip package size for nghtml2js-jest in KB

Readme

nghtml2js-jest
Jest preprocessor to turn Angular 1 templates into JS and put in modules.
!Build Statusbuild-badgebuild !versionversion-badgepackage !PRs Welcomeprs-badge !All Contributorsall-contributors-badge

Install

npm install --save-dev ng2html2js nghtml2js-jest or yarn ng2html2js nghtml2js-jest --dev

Example

Assuming the project uses babel, create a jest.json file and use the nghtml2js-jest preprocessor to transform html files. The test/setup.js file will probably be needed to import angular and angular-mocks.
{
  "bail": true,
  "verbose": true,
  "transform": {
    "^.+\\.js$": "babel-jest",
    "^.+\\.html$": "<rootDir>/node_modules/nghtml2js-jest/preprocessor.js"
  },
  "moduleFileExtensions": [
    "js"
  ],
  "setupTestFrameworkScriptFile": "<rootDir>/test/setup.js"
}

For a more complete example have a look at the example folder.

Contributors

Thanks goes to these wonderful people (emoji key):
|
Spyros Ioakeimidis

💬 💻 ⚠️ | | :---: |
This project follows the all-contributors specification. Contributions of any kind welcome!