0.0.1 • Published 3 years ago

riot-v6-jest-transformer v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Riot-v6-jest-transformer

Usage

Install via NPM with babel-jest, which this module depends.

npm i -D babel-jest riot-v6-jest-transformer

Edit jest.config.js or something like this.

module.exports = {
  moduleFileExtensions: [
    "js",
    "riot",
  ],
  transform: {
    "^.+\\.js$": "babel-jest",
    "^.+\\.riot$": "./lib/index.js"
  }
}

Note

This module requires babel environment.

You need to prepare for your own.

Install modules.

npm i -D @babel/core @babel/preset-env

Edit .babelrc.

{
  "presets": [
    [
      "@babel/preset-env",
      {
        "targets": {
          "node": "current",
        },
      },
    ],
  ]
}

Remember to set "@babel/preset-typescript" with allowExtension if you use TypeScript in your tags.

{
  "presets": [
    [
      "@babel/preset-env",
      {
        "targets": {
          "node": "current",
        },
      },
    ],
    [
      "@babel/preset-typescript",
      {
        "allExtensions": true,
      }
    ]
  ]
}