Coder Social home page Coder Social logo

eslint-plugin-jest-extended's Introduction

eslint-plugin-jest-extended

ESLint plugin for Jest Extended

Actions Status

Installation

$ yarn add --dev eslint eslint-plugin-jest-extended

Note: If you installed ESLint globally then you must also install eslint-plugin-jest-extended globally.

Usage

Note

eslint.config.js is supported, though most of the plugin documentation still currently uses .eslintrc syntax.

Refer to the ESLint documentation on the new configuration file format for more.

Add jest-extended to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": ["jest-extended"]
}

Then configure the rules you want to use under the rules section.

{
  "rules": {
    "jest-extended/prefer-to-be-true": "warn",
    "jest-extended/prefer-to-be-false": "error"
  }
}

Shareable configurations

Recommended

This plugin does not export a recommended configuration, as the rules provided by this plugin are about enforcing usage of preferred matchers for particular patterns, rather than helping to prevent bugs & commonly overlooked traps.

All

If you want to enable all rules instead of only some you can do so by adding the all configuration to your .eslintrc config file:

{
  "extends": ["plugin:jest-extended/all"]
}

To enable this configuration with eslint.config.js, use jestExtended.configs['flat/all']:

const jestExtended = require('eslint-plugin-jest-extended');

module.exports = [
  {
    files: [
      /* glob matching your test files */
    ],
    ...jestExtended.configs['flat/all'],
  },
];

Note that the all configuration may change in any release and is thus unsuited for installations requiring long-term consistency.

Rules

πŸ”§ Automatically fixable by the --fix CLI option.

Name Description πŸ”§
prefer-to-be-array Suggest using toBeArray() πŸ”§
prefer-to-be-false Suggest using toBeFalse() πŸ”§
prefer-to-be-object Suggest using toBeObject() πŸ”§
prefer-to-be-true Suggest using toBeTrue() πŸ”§
prefer-to-have-been-called-once Suggest using toHaveBeenCalledOnce() πŸ”§

Credit

Related Projects

eslint-plugin-jest

This project aims to provide linting rules to aid in writing tests using jest.

https://github.com/jest-community/eslint-plugin-jest

eslint-plugin-jest-formatting

This project aims to provide formatting rules (auto-fixable where possible) to ensure consistency and readability in jest test suites.

https://github.com/dangreenisrael/eslint-plugin-jest-formatting

eslint-plugin-jest-extended's People

Contributors

g-rath avatar renovate[bot] avatar semantic-release-bot avatar simenb avatar

Stargazers

 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

Forkers

willemorvets

eslint-plugin-jest-extended's Issues

Results of weekly scheduled smoke test

Something went wrong. This is likely an internal error of eslint-remote-tester-run-action.

Click to expand
TSError: β¨― Unable to compile TypeScript:
error TS6053: File '@tsconfig/node12/tsconfig.json' not found.

    at createTSError (/github/workspace/node_modules/ts-node/src/index.ts:859:12)
    at reportTSError (/github/workspace/node_modules/ts-node/src/index.ts:863:19)
    at createFromPreloadedConfig (/github/workspace/node_modules/ts-node/src/index.ts:874:36)
    at create (/github/workspace/node_modules/ts-node/src/index.ts:624:10)
    at Object.register (/github/workspace/node_modules/ts-node/src/index.ts:591:15)
    at loadTSConfig (/github/workspace/node_modules/eslint-remote-tester/dist/config/load.js:11:56)
    at loadConfig (/github/workspace/node_modules/eslint-remote-tester/dist/config/load.js:28:41)
    at runTester (/index.js:5935:14)
    at /index.js:5992:61
    at Object.<anonymous> (/index.js:284:24)

Setup release workflow (+ do initial release)

While the release workflow exists, it's currently not setup to publish (iirc its not got a token?).

We should get that sorted and release v1 so people can start using this πŸŽ‰

(I've not actually got the access writes needed to do this, so @SimenB or @mattphillips could either of you action this?)

Dependency Dashboard

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

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm eslint-plugin-eslint-comments Available

Rate-Limited

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

  • chore(deps): replace dependency eslint-plugin-eslint-comments with @eslint-community/eslint-plugin-eslint-comments ^3.2.0
  • chore(deps): lock file maintenance
  • πŸ” 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.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/lint.yml
  • actions/checkout v4
  • wagoid/commitlint-github-action v6
  • actions/checkout v4
  • danger/danger-js 12.3.0
.github/workflows/markdown-link-check.yml
  • actions/checkout v4
  • actions/setup-node v4
.github/workflows/nodejs.yml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
  • codecov/codecov-action v3
  • actions/checkout v4
  • actions/setup-node v4
  • actions/checkout v4
  • actions/setup-node v4
.github/workflows/prepare-cache.yml
  • actions/checkout v4
  • actions/setup-node v4
.github/workflows/smoke-test.yml
  • actions/checkout v4
  • actions/setup-node v4
  • AriPerkkio/eslint-remote-tester-run-action v4
.github/workflows/test.yml
  • actions/checkout v4
  • actions/setup-node v4
npm
package.json
  • @typescript-eslint/utils ^5.10.0
  • @babel/cli ^7.4.4
  • @babel/core ^7.4.4
  • @babel/preset-env ^7.4.4
  • @babel/preset-typescript ^7.3.3
  • @commitlint/cli ^19.0.0
  • @commitlint/config-conventional ^19.0.0
  • @schemastore/package ^0.0.10
  • @semantic-release/changelog ^6.0.0
  • @semantic-release/git ^10.0.0
  • @tsconfig/node14 ^14.0.0
  • @types/dedent ^0.7.0
  • @types/jest ^29.0.0
  • @types/node ^14.17.0
  • @typescript-eslint/eslint-plugin ^5.0.0
  • @typescript-eslint/parser ^5.0.0
  • babel-jest ^29.0.0
  • babel-plugin-replace-ts-export-assignment ^0.0.2
  • dedent ^1.0.0
  • eslint ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0
  • eslint-config-prettier ^9.0.0
  • eslint-doc-generator ^1.0.0
  • eslint-plugin-eslint-comments ^3.1.2
  • eslint-plugin-eslint-plugin ^6.0.0
  • eslint-plugin-import ^2.18.0
  • eslint-plugin-n ^15.0.0
  • eslint-plugin-prettier ^5.0.0
  • eslint-remote-tester ^3.0.0
  • eslint-remote-tester-repositories ^1.0.0
  • husky ^9.0.0
  • is-ci ^3.0.0
  • jest ^29.0.0
  • jest-runner-eslint ^2.0.0
  • lint-staged ^13.0.3
  • markdown-link-check ^3.10.3
  • pinst ^3.0.0
  • prettier ^3.0.0
  • rimraf ^5.0.0
  • semantic-release ^23.0.0
  • semver ^7.6.0
  • ts-node ^10.9.1
  • typescript ^5.0.0
  • eslint ^7.0.0 || ^8.0.0 || ^9.0.0
  • node ^14.15.0 || ^16.10.0 || >=18.0.0
  • @typescript-eslint/experimental-utils ^5.0.0
  • yarn 3.8.4

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

More suggestions

It'd be nice to have more suggestions:

expect(typeof x === 'string') -> expect(x).toBeString()
expect(typeof x === 'boolean') -> expect(x).toBeBoolean()
expect(typeof x === 'number') -> expect(x).toBeNumber()
expect(x.includes(y)) -> expect(x).toInclude(y)

And so on.

The automated release is failing 🚨

🚨 The automated release from the main branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the main branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


No npm token specified.

An npm token must be created and set in the NPM_TOKEN environment variable on your CI environment.

Please make sure to create an npm token and to set it in the NPM_TOKEN environment variable on your CI environment. The token must allow to publish to the registry https://registry.npmjs.org/.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

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.