Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/keplersj/jest-runner-remark
Jest runner to run remark-lint
https://github.com/keplersj/jest-runner-remark
jest jest-runner lint linter markdown mdx remark
Last synced: 3 months ago
JSON representation
Jest runner to run remark-lint
- Host: GitHub
- URL: https://github.com/keplersj/jest-runner-remark
- Owner: keplersj
- Created: 2019-08-15T21:45:23.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-10-08T22:28:11.000Z (4 months ago)
- Last Synced: 2024-10-13T22:31:00.203Z (3 months ago)
- Topics: jest, jest-runner, lint, linter, markdown, mdx, remark
- Language: TypeScript
- Size: 2.86 MB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# jest-runner-remark
[![npm](https://img.shields.io/npm/v/jest-runner-remark)](https://www.npmjs.com/package/jest-runner-remark)
[![npm](https://img.shields.io/npm/dw/jest-runner-remark)](https://www.npmjs.com/package/jest-runner-remark)
[![Codecov](https://img.shields.io/codecov/c/github/keplersj/jest-runner-remark)](https://app.codecov.io/gh/keplersj/jest-runner-remark)
[![Bundle Size](https://img.shields.io/bundlephobia/min/jest-runner-remark)](https://bundlephobia.com/package/jest-runner-remark)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://www.conventionalcommits.org/)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`](https://github.com/remarkjs/remark-lint#configuring-remark-lint) before continuing.
### Install jest-runner-remark
Install `jest` and `jest-runner-remark`
```bash
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](https://jestjs.io/docs/en/configuration#preset-string) which configures Jest to run Remark on all files supported by Remark. To use it set the following in your package.json:
```json
{
"jest": {
"preset": "jest-runner-remark"
}
}
```or jest.config.js:
```js
module.exports = {
preset: "jest-runner-remark",
};
```#### Manually
In your `package.json`
```json
{
"jest": {
"runner": "remark",
"moduleFileExtensions": ["md", "mdx", "markdown", "mkd", "mkdn", "mkdown"],
"testMatch": [
"/**/*.md",
"/**/*.mdx",
"/**/*.markdown",
"/**/*.mkd",
"/**/*.mkdn",
"/**/*.mkdown"
]
}
}
```Or in `jest.config.js`
```js
module.exports = {
runner: "remark",
moduleFileExtensions: ["md", "mdx", "markdown", "mkd", "mkdn", "mkdown"],
testMatch: [
"/**/*.md",
"/**/*.mdx",
"/**/*.markdown",
"/**/*.mkd",
"/**/*.mkdn",
"/**/*.mkdown",
],
};
```### Run Jest
```bash
npx jest# or with yarn
yarn jest
```