diff --git a/test/.eslintrc.yml b/test/.eslintrc.yml index 2cfb7601..33d5b6c5 100644 --- a/test/.eslintrc.yml +++ b/test/.eslintrc.yml @@ -1,7 +1,6 @@ env: jest: true - jasmine: true rules: no-require: off global-require: off diff --git a/test/CSSTransition-test.js b/test/CSSTransition-test.js index 2eb925e4..98e2893a 100644 --- a/test/CSSTransition-test.js +++ b/test/CSSTransition-test.js @@ -3,14 +3,6 @@ import { mount } from 'enzyme'; import CSSTransition from '../src/CSSTransition'; -jasmine.addMatchers({ - toExist: () => ({ - compare: actual => ({ - pass: actual != null, - }) - }) -}); - describe('CSSTransition', () => { it('should flush new props to the DOM before initiating a transition', (done) => { diff --git a/test/CSSTransitionGroup-test.js b/test/CSSTransitionGroup-test.js index 472d8385..1a41ffbe 100644 --- a/test/CSSTransitionGroup-test.js +++ b/test/CSSTransitionGroup-test.js @@ -9,6 +9,7 @@ let TransitionGroup; // makes sure we're wired up correctly. describe('CSSTransitionGroup', () => { let container; + let consoleErrorSpy; function YoloTransition({ id, ...props }) { return ( @@ -28,7 +29,11 @@ describe('CSSTransitionGroup', () => { TransitionGroup = require('../src/TransitionGroup'); container = document.createElement('div'); - spyOn(console, 'error'); + consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); + }); + + afterEach(() => { + consoleErrorSpy.mockRestore(); }); @@ -55,7 +60,7 @@ describe('CSSTransitionGroup', () => { jest.runAllTimers(); // No warnings - expect(console.error.calls.count()).toBe(0); + expect(consoleErrorSpy).not.toHaveBeenCalled(); // The leaving child has been removed expect(ReactDOM.findDOMNode(a).childNodes.length).toBe(1); diff --git a/test/Transition-test.js b/test/Transition-test.js index 27fb6cae..63d30c0e 100644 --- a/test/Transition-test.js +++ b/test/Transition-test.js @@ -11,12 +11,17 @@ import Transition, { EXITING, } from '../src/Transition' -jasmine.addMatchers({ - toExist: () => ({ - compare: actual => ({ - pass: actual != null, - }), - }), +expect.extend({ + toExist(received) { + const pass = received != null + return pass ? { + message: () => `expected ${received} to be null or undefined`, + pass: true, + } : { + message: () => `expected ${received} not to be null or undefined`, + pass: false, + } + }, }) describe('Transition', () => {