An open API service indexing awesome lists of open source software.

https://github.com/spirosikmd/nghtml2js-jest

Jest preprocessor to turn Angular 1 templates into JS and put in modules.
https://github.com/spirosikmd/nghtml2js-jest

angular1 angularjs jest nghtml2js

Last synced: 3 months ago
JSON representation

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

Awesome Lists containing this project

README

        

# nghtml2js-jest

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

[![Build Status][build-badge]][build]
[![version][version-badge]][package]
[![PRs Welcome][prs-badge]](http://makeapullrequest.com)
[![All Contributors][all-contributors-badge]](#contributors)

## Install

`npm install --save-dev ng-html2js nghtml2js-jest`

or

`yarn add ng-html2js 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`.

```json
{
"bail": true,
"verbose": true,
"transform": {
"^.+\\.js$": "babel-jest",
"^.+\\.html$": "/node_modules/nghtml2js-jest/preprocessor.js"
},
"moduleFileExtensions": [
"js"
],
"setupTestFrameworkScriptFile": "/test/setup.js"
}
```

For a more complete example have a look at the [example](https://github.com/spirosikmd/nghtml2js-jest/tree/master/example) folder.

## Contributors

Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):

| [
Spyros Ioakeimidis](http://www.spyros.io)
[💬](#question-spirosikmd "Answering Questions") [💻](https://github.com/spirosikmd/nghtml2js/commits?author=spirosikmd "Code") [⚠️](https://github.com/spirosikmd/nghtml2js/commits?author=spirosikmd "Tests") |
| :---: |

This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification.
Contributions of any kind welcome!

[version-badge]: https://img.shields.io/npm/v/nghtml2js-jest.svg?style=flat-square
[package]: https://www.npmjs.com/package/nghtml2js-jest
[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
[build-badge]: https://img.shields.io/travis/spirosikmd/nghtml2js-jest.svg?style=flat-square
[build]: https://travis-ci.org/spirosikmd/nghtml2js-jest.svg
[all-contributors-badge]: https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square
[greenkeeper-badge]: https://badges.greenkeeper.io/spirosikmd/nghtml2js-jest.svg