jest/no-jasmine-globals
eslint-plugin-jest
Safe autofixRecommended
eslint.config.js
import jest from "eslint-plugin-jest";
export default [
{
plugins: { jest },
rules: {
"jest/no-jasmine-globals": "error",
},
},
];jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000;
test('my test', () => {
pending();
});
test('my test', () => {
jasmine.createSpy();
});jest.setTimeout(5000);
test('my test', () => {
// Use test.skip() instead of pending()
});
test.skip('my test', () => {
// Skipped test
});
test('my test', () => {
jest.fn(); // Use jest.fn() instead of jasmine.createSpy()
});Examples from the Oxlint documentation.
jest/no-jasmine-globals
eslint-plugin-jest
import jest from "eslint-plugin-jest";
export default [
{
plugins: { jest },
rules: {
"jest/no-jasmine-globals": "error",
},
},
];jest/no-jasmine-globals
jest plugin · style
{
"plugins": [
"jest"
],
"rules": {
"jest/no-jasmine-globals": "error"
}
}nursery/noJasmineGlobals
nursery · since 2.6.9
{
"linter": {
"rules": {
"nursery": {
"noJasmineGlobals": "error"
}
}
}
}Disallow using a callback in asynchronous tests and hooks
Disallow using expect outside of it or test blocks
Disallow calling expect conditionally
Enforce assertion to be made in a test body