Commit e70fae8d authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'winh-jest-no-jasmine-globals' into 'master'

Enable ESLint rule jest/no-jasmine-globals

See merge request gitlab-org/gitlab-ce!27137
parents 48945e92 e658b337
......@@ -14,3 +14,4 @@ globals:
setFixtures: false
rules:
jest/no-focused-tests: error
jest/no-jasmine-globals: error
......@@ -31,7 +31,7 @@ describe('ErrorTrackingList', () => {
actions = {
getErrorList: () => {},
startPolling: () => {},
restartPolling: jasmine.createSpy('restartPolling'),
restartPolling: jest.fn().mockName('restartPolling'),
};
const state = {
......
......@@ -8,7 +8,7 @@ describe('RecentSearchesServiceError', () => {
});
it('instantiates an instance of RecentSearchesServiceError and not an Error', () => {
expect(recentSearchesServiceError).toEqual(jasmine.any(RecentSearchesServiceError));
expect(recentSearchesServiceError).toEqual(expect.any(RecentSearchesServiceError));
expect(recentSearchesServiceError.name).toBe('RecentSearchesServiceError');
});
......
......@@ -8,7 +8,7 @@ describe('Multi-file editor library disposable class', () => {
instance = new Disposable();
disposableClass = {
dispose: jasmine.createSpy('dispose'),
dispose: jest.fn().mockName('dispose'),
};
});
......
......@@ -2,7 +2,7 @@ import editorOptions from '~/ide/lib/editor_options';
describe('Multi-file editor library editor options', () => {
it('returns an array', () => {
expect(editorOptions).toEqual(jasmine.any(Array));
expect(editorOptions).toEqual(expect.any(Array));
});
it('contains readOnly option', () => {
......
......@@ -25,14 +25,14 @@ describe('Abuse Reports', () => {
it('should truncate long messages', () => {
const $longMessage = findMessage('LONG MESSAGE');
expect($longMessage.data('originalMessage')).toEqual(jasmine.anything());
expect($longMessage.data('originalMessage')).toEqual(expect.anything());
assertMaxLength($longMessage);
});
it('should not truncate short messages', () => {
const $shortMessage = findMessage('SHORT MESSAGE');
expect($shortMessage.data('originalMessage')).not.toEqual(jasmine.anything());
expect($shortMessage.data('originalMessage')).not.toEqual(expect.anything());
});
it('should allow clicking a truncated message to expand and collapse the full message', () => {
......
......@@ -13,7 +13,7 @@ describe('EmojiMenu', () => {
let dummyEmojiList;
beforeEach(() => {
dummySelectEmojiCallback = jasmine.createSpy('dummySelectEmojiCallback');
dummySelectEmojiCallback = jest.fn().mockName('dummySelectEmojiCallback');
dummyEmojiList = {
glEmojiTag() {
return dummyEmojiTag;
......@@ -75,19 +75,19 @@ describe('EmojiMenu', () => {
expect(emojiMenu.registerEventListener).toHaveBeenCalledWith(
'one',
jasmine.anything(),
expect.anything(),
'mouseenter focus',
dummyToggleButtonSelector,
'mouseenter focus',
jasmine.anything(),
expect.anything(),
);
expect(emojiMenu.registerEventListener).toHaveBeenCalledWith(
'on',
jasmine.anything(),
expect.anything(),
'click',
dummyToggleButtonSelector,
jasmine.anything(),
expect.anything(),
);
});
......@@ -96,10 +96,10 @@ describe('EmojiMenu', () => {
expect(emojiMenu.registerEventListener).toHaveBeenCalledWith(
'on',
jasmine.anything(),
expect.anything(),
'click',
`.js-awards-block .js-emoji-btn, .${dummyMenuClass} .js-emoji-btn`,
jasmine.anything(),
expect.anything(),
);
});
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment