Skip to content

A jest transformer for MDX with frontMatter support

Notifications You must be signed in to change notification settings

ccesare/jest-transformer-mdx

 
 

Repository files navigation

jest-transformer-mdx

Github release version Commits since release npm release version

Introduction

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

About

A jest transformer for MDX with frontMatter support

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%