Skip to content

Latest commit

 

History

History
53 lines (35 loc) · 1.76 KB

README.md

File metadata and controls

53 lines (35 loc) · 1.76 KB

jest-transformer-mdx

Github release version Commits since release npm release version

Introduction

A simple jest transformer for MDX with frontMatter support.

Instructions

Install

yarn add jest-transformer-mdx

Add to your jest config

// jest.config.js
module.exports = {
  // A map from regular expressions to paths to transformers
  transform: {
    "^.+\\.(md|mdx)$": 'jest-transformer-mdx',
  },
};

And that should be it! jest-transformer-mdx will pick up your babel config and use your jest config.

Example

Look inside this library's test and the related markdown file to see live a example.

create-react-app & configless

You can also use this module in create-react-app-like apps where the config is not exposed. Just edit your transform property to import from jest-transformer-mdx/cra

// jest.config.js
module.exports = {
  transform: {
    "^.+\\.(md|mdx)$": 'jest-transformer-mdx/cra',
  },
};

Credits

Made possible by