Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cprussin/jest-runner-prettier

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cprussin/jest-runner-prettier

A prettier runner for Jest

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

npm npm Codecov Bundle Size Conventional Commits Mentioned in Awesome Jest

jest-runner-prettier

Prettier runner for Jest

Usage

Install

Install jest, prettier and jest-runner-prettier

yarn add --dev jest prettier jest-runner-prettier

# or with NPM

npm install --save-dev jest prettier jest-runner-prettier

Add it to your Jest config

Using Built-in Preset

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

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

or jest.config.js:

module.exports = {
  preset: "jest-runner-prettier",
};
Manually

In your package.json

{
  "jest": {
    "runner": "prettier",
    "moduleFileExtensions": [
      "js",
      "mjs",
      "jsx",
      "vue",
      "ts",
      "tsx",
      "css",
      "less",
      "scss",
      "html",
      "json",
      "graphql",
      "md",
      "markdown",
      "mdx",
      "yaml",
      "yml"
    ],
    "testMatch": [
      "**/*.js",
      "**/*.mjs",
      "**/*.jsx",
      "**/*.vue",
      "**/*.ts",
      "**/*.tsx",
      "**/*.css",
      "**/*.less",
      "**/*.scss",
      "**/*.html",
      "**/*.json",
      "**/*.graphql",
      "**/*.md",
      "**/*.markdown",
      "**/*.mdx",
      "**/*.yaml",
      "**/*.yml"
    ]
  }
}

Or in jest.config.js

module.exports = {
  runner: "prettier",
  moduleFileExtensions: [
    "js",
    "mjs",
    "jsx",
    "vue",
    "ts",
    "tsx",
    "css",
    "less",
    "scss",
    "html",
    "json",
    "graphql",
    "md",
    "markdown",
    "mdx",
    "yaml",
    "yml",
  ],
  testMatch: [
    "**/*.js",
    "**/*.mjs",
    "**/*.jsx",
    "**/*.vue",
    "**/*.ts",
    "**/*.tsx",
    "**/*.css",
    "**/*.less",
    "**/*.scss",
    "**/*.html",
    "**/*.json",
    "**/*.graphql",
    "**/*.md",
    "**/*.markdown",
    "**/*.mdx",
    "**/*.yaml",
    "**/*.yml",
  ],
};

Run Jest

npx jest

# or, with yarn

yarn jest

License

Copyright Kepler Sticka-Jones 2017-2022. Licensed MIT.

FAQs

Package last updated on 20 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc