Git Product home page Git Product logo

jest-runner-prettier's Introduction

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.

jest-runner-prettier's People

Contributors

calamarico avatar dependabot-preview[bot] avatar hph avatar keplersj avatar renovate-bot avatar renovate[bot] avatar rickhanlonii avatar robertkowalski avatar rogeliog avatar zaubernerd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

jest-runner-prettier's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Using npm packages for Renovate presets is now deprecated. Please migrate to repository-based presets instead.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency ts-jest to v29.1.3
  • fix(deps): update dependency create-lite-jest-runner to v1.1.0
  • chore(deps): update actions/checkout action to v4
  • chore(deps): update actions/setup-node action to v4
  • chore(deps): update codecov/codecov-action action to v4
  • chore(deps): update commitlint monorepo to v19 (major) (@commitlint/cli, @commitlint/config-conventional)
  • chore(deps): update dependency @types/node to v20
  • chore(deps): update dependency eslint to v9
  • chore(deps): update dependency husky to v9
  • chore(deps): update dependency jest-runner-eslint to v2
  • chore(deps): update dependency lint-staged to v15
  • chore(deps): update dependency prettier to v3
  • chore(deps): update dependency typescript to v5
  • fix(deps): update dependency emphasize to v7
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/node.yml
  • actions/checkout v3
  • actions/setup-node v3
  • codecov/codecov-action v3.1.1
.github/workflows/release.yml
  • actions/checkout v3
  • actions/setup-node v3
npm
package.json
  • create-lite-jest-runner ^1.0.2
  • emphasize ^5.0.0
  • jest-diff ^29.0.0
  • @commitlint/cli 17.2.0
  • @commitlint/config-conventional 17.2.0
  • @types/jest 29.2.2
  • @types/node 18.11.9
  • eslint 8.27.0
  • eslint-config-starstuff 1.5.14
  • husky 8.0.3
  • jest 29.3.1
  • jest-runner-eslint 1.1.0
  • lint-staged 13.0.3
  • prettier 2.7.1
  • ts-jest 29.0.3
  • typescript 4.8.4
  • jest >= 27.0.0
  • prettier >= 1.8

  • Check this box to trigger a request for Renovate to run again on this repository

Use of mutation testing in jest-runner-prettier - Help needed

Hello there!

My name is Ana. I noted that you use the mutation testing tool in the project.
I am a postdoctoral researcher at the University of Seville (Spain), and my colleagues and I are studying how mutation testing tools are used in practice. With this aim in mind, we have analysed over 3,500 public GitHub repositories using mutation testing tools, including yours! This work has recently been published in a journal paper available at https://link.springer.com/content/pdf/10.1007/s10664-022-10177-8.pdf.

To complete this study, we are asking for your help to understand better how mutation testing is used in practice, please! We would be extremely grateful if you could contribute to this study by answering a brief survey of 21 simple questions (no more than 6 minutes). This is the link to the questionnaire https://forms.gle/FvXNrimWAsJYC1zB9.

Drop me an e-mail if you have any questions or comments ([email protected]). Thank you very much in advance!!

Update jest-diff version to avoid diff security problem

The last version of this package is 0.2.6 and it has a dependency of jest-diff resolved with version 22.4.3 that uses the diff package version 3.3.1.

That diff version has a security problem reported by github and recommend to update to diff 3.5.0 version.
I have seen there are some many breaking changes since jest-diff 22.4.3
Have you tried to update your dependency of jest-diff?
If you need some help I can open a Pull Request trying to update your jest-diff dependency

@keplersj
PR Opened: #111

Coverage information missing

I noticed that collectCoverage: true does not work with this test runner. Is this something that can't be supported or just an implementation detail? I noticed that this project has two Jest configs, one with coverage on and another without. I'd personally want to avoid running Jest twice, and saw this project as a nice way of testing that formatting had been done without another command.

I'd personally be fine with disabling this runner when coverage information really is required (like in CI environments), but it seems like this is an oversight and it complicates setup a bit. I'd be happy to help in fixing this, if you think it should be.

Underscore the differences

I've loved syntax highlighting, but I felt it got noticing diffs a little bit harder, so It would be nice if the different parts got highlighted (by underscores or background color), so it would be easier to notice where it did change.

runner does not pick up the prettier configs

I have a project with a .prettierrc and a .prettierignore and both of them are not being picked up. A PR adding jest-runner-prettier is failing, I think the problem is in this project. I wonder why, because I saw prettier.resolveConfig in your code, that should basically have done the trick, right?

Does this run Prettier?

I see failures here and it isn't updating the code with prettier, am I doing something wrong here? I thought it would update it.

If it doesn't I'd like it to work like updating snapshots where I can rerun it with -u and have prettier fix things.

Your .dependabot/config.yml contained invalid details

Dependabot encountered the following error when parsing your .dependabot/config.yml:

The property '#/update_configs/0/automerged_updates/0' contains additional properties ["dependency_type", "update_type"] outside of the schema when none are allowed
The property '#/update_configs/0/automerged_updates/0/match' of type null did not match the following type: object

Please update the config file to conform with Dependabot's specification using our docs and online validator.

You can mention @dependabot in the comments below to contact the Dependabot team.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.