Skip to content
Jest runner to run remark-lint
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.dependabot
.github/workflows
src
.gitignore
README.md
commitlint.config.js
jest-preset.js
jest.config.js
package-lock.json
package.json

README.md

jest-runner-remark

npm version

Jest runner for Remark.

Usage

Configure remark-lint

jest-runner-remark is best used alongside a remark-lint configuration. See the documentation on configuring remark-lint before continuing.

Install jest-runner-remark

Install jest and jest-runner-remark

npm install --save-dev jest jest-runner-remark

# or with yarn

yarn add --dev jest jest-runner-remark

Add it to your Jest config

Using Built-in Preset

This package includes a Jest preset which configures Jest to run Remark on all files supported by Remark. To use it set the following in your package.json:

{
  "jest": {
    "preset": "jest-runner-remark"
  }
}

or jest.config.js:

module.exports = {
  preset: "jest-runner-remark"
};

Manually

In your package.json

{
  "jest": {
    "runner": "remark",
    "moduleFileExtensions": ["md", "mdx", "markdown", "mkd", "mkdn", "mkdown"],
    "testMatch": [
      "<rootDir>/**/*.md",
      "<rootDir>/**/*.mdx",
      "<rootDir>/**/*.markdown",
      "<rootDir>/**/*.mkd",
      "<rootDir>/**/*.mkdn",
      "<rootDir>/**/*.mkdown"
    ]
  }
}

Or in jest.config.js

module.exports = {
  runner: "remark",
  moduleFileExtensions: ["md", "mdx", "markdown", "mkd", "mkdn", "mkdown"],
  testMatch: [
    "<rootDir>/**/*.md",
    "<rootDir>/**/*.mdx",
    "<rootDir>/**/*.markdown",
    "<rootDir>/**/*.mkd",
    "<rootDir>/**/*.mkdn",
    "<rootDir>/**/*.mkdown"
  ]
};

Run Jest

npx jest

# or with yarn

yarn jest
You can’t perform that action at this time.