Top "Jestjs" questions

Jest is a JavaScript unit testing framework made by Facebook based on Jasmine and provides automated mock creation and a jsdom environment.

How to mock/replace getter function of object with Jest?

In Sinon I can do the following: var myObj = { prop: 'foo' }; sinon.stub(myObj, 'prop').get(function getterFn() { return 'bar'; }); …

javascript reactjs mocking sinon jestjs
Does Jest support ES6 import/export?

If I use import/export from ES6 then all my Jest tests fail with error: Unexpected reserved word I convert …

ecmascript-6 jestjs babel-jest
How to reset or clear a spy in Jest?

I have a spy that is used in multiple assertions across multiple tests in a suite. How do I clear …

javascript testing jestjs
jest + enzyme, using mount(), document.getElementById() returns null on component which appear after _method call

I faced a problem with my jest+enzyme mount() testing. I am testing a function, which switches displaying components. Switch …

reactjs testing jestjs enzyme mount
What is the difference between 'toBe' and 'toEqual' in Jest?

Jest documentation reads: toBe just checks that a value is what you expect. It uses === to check strict equality. And …

testing jestjs
Testing dispatched actions in Redux thunk with Jest

I'm quite new to Jest and admittedly am no expert at testing async code... I have a simple Fetch helper …

reactjs redux fetch jestjs redux-thunk
Can't bind to 'matMenuTriggerFor' since it isn't a known property of 'button'

I'm getting following error when I try to test an angular component: Error while running jest tests: Can't bind to …

angular angular-material karma-jasmine jestjs
Cannot find name 'it' in Jest TypeScript

I try to create an intial setup for Jest in React + TypeScript. I have completed the initial setup and try …

typescript npm jestjs ts-jest
What's the difference between '.toMatchObject' and 'objectContaining'

I have written the following test: it('Can decrement the current step', function () { expect(reducer(TestState, { type: 'GOTO_PREVIOUS_STEP' })).…

javascript jestjs
How does jest.fn() work

Can anyone explain how does jest.fn() actually work with a real world example , as i'm literally confused on how …

unit-testing reactjs es6-promise jestjs