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.

Skip one test in test file Jest

I'm using Jest framework and have a test suite. I want to turn off/skip one of my tests. Googling …

javascript node.js testing jestjs
Using Jest to mock a React component with props

I have a React component which contains some other components that depend on access to a Redux store etc., which …

reactjs unit-testing mocking jestjs enzyme
How can I get the arguments called in jest mock function?

How can I get the arguments called in jest mock function? I want to inspect the object that is passed …

javascript jestjs
Jest: How to mock one specific method of a class

Let's suppose I have the following class: export default class Person { constructor(first, last) { this.first = first; this.last = last; } …

javascript jestjs
Jest fails with "Unexpected token *" on import statement

Why does Jest fail with "Unexpected token *" on a simple import statement... Error log: Admin@Admin-PC MINGW32 /d/project (master) $ …

javascript typescript jestjs
jest global variable example

Can someone give an example on how to use jest globals? { ... "jest": { "globals": { "__DEV__": true, } } ... } Do I specify the globals …

jestjs
How to make Jest wait for all asynchronous code to finish execution before expecting an assertion

I am writing an integration test for for a React application, i.e. a test that tests many components together, …

reactjs mocking jestjs enzyme
How to reset Jest mock functions calls count before every test

I'm new to Jest, I'm trying to use it for testing if a function was called or not. I noticed …

javascript unit-testing jestjs
Cannot find name 'describe'. Do you need to install type definitions for a test runner?

When using TypeScript in conjunction with Jest, my specs would fail with error messages like: test/unit/some.spec.ts:1:1 …

typescript jestjs
Jest: Better way to disable console inside unit tests

I wonder if there is a better way to disable console errors inside a specific Jest test (i.e., restore …

javascript unit-testing mocking jestjs