Files
formipay/node_modules/eslint-plugin-jest/docs/rules/no-restricted-jest-methods.md
dwindown e8fbfb14c1 fix: prevent asset conflicts between React and Grid.js versions
Add coexistence checks to all enqueue methods to prevent loading
both React and Grid.js assets simultaneously.

Changes:
- ReactAdmin.php: Only enqueue React assets when ?react=1
- Init.php: Skip Grid.js when React active on admin pages
- Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0
- Customer.php, Product.php, License.php: Add coexistence checks

Now the toggle between Classic and React versions works correctly.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-18 17:02:14 +07:00

1.0 KiB

Disallow specific jest. methods (no-restricted-jest-methods)

You may wish to restrict the use of specific jest methods.

Rule details

This rule checks for the usage of specific methods on the jest object, which can be used to disallow certain patterns such as spies and mocks.

Options

Restrictions are expressed in the form of a map, with the value being either a string message to be shown, or null if a generic default message should be used.

By default, this map is empty, meaning no jest methods are banned.

For example:

{
  "jest/no-restricted-jest-methods": [
    "error",
    {
      "advanceTimersByTime": null,
      "spyOn": "Don't use spies"
    }
  ]
}

Examples of incorrect code for this rule with the above configuration

jest.useFakeTimers();
it('calls the callback after 1 second via advanceTimersByTime', () => {
  // ...

  jest.advanceTimersByTime(1000);

  // ...
});

test('plays video', () => {
  const spy = jest.spyOn(video, 'play');

  // ...
});