close

no-jasmine-globals

Configuration

PresetConfigured Value
✅ jestPlugin.configs.recommended"error"
rslint.config.ts
import { defineConfig, jestPlugin } from '@rslint/core';

export default defineConfig([
  jestPlugin.configs.recommended,
  {
    rules: {
      'jest/no-jasmine-globals': 'error',
    },
  },
]);

Rule Details

Jest supports running without Jasmine globals. This rule disallows using Jasmine-specific globals and APIs in tests, and requires the Jest equivalents instead.

Examples of incorrect code for this rule:

spyOn(obj, 'method');
fail();
pending();
jasmine.addMatchers(matchers);
jasmine.createSpy();
jasmine.any(Number);
jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000;

Examples of correct code for this rule:

jest.spyOn(obj, 'method');
throw new Error('failed');
test.skip('skipped for now', () => {});
expect.extend(matchers);
jest.fn();
expect.any(Number);
jest.setTimeout(5000);

Original Documentation