The application is written by React with ES6 so import and export statements are used inside the application. So Jest is configured to work compatible with ES6,
I try to create an intial setup for Jest in React + TypeScript. I have completed the initial setup and try to check whether the test runs. When I run the test u
I am trying set up tests with Jest in a create-react-app that is using the override function from customize-cra and react-app-rewired. I have set up a relative
I am trying to run my project's tests on my CI/CD machines. They are jest tests that have been running fine for some time on all my environments. I am going t
I'm using Material-UI's useMediaQuery() function in one of my components to determine the size prop to use for a <Button> within the component. I'm tryin
Jest documentation reads: toBe just checks that a value is what you expect. It uses === to check strict equality. And for toEqual: Use .toEqual when
I tried many solution from this task. I want testing axios instance api call without any libralies (jest-axios-mock, moaxios, msw, etc). I hope it's possible, b
I'm attempting to follow this guide in Reat-Testing-Library documentation to wrap all the components I want to test. I'm doing this because I need access to the
I'm unable to mock moment() or moment().format functions. I have states where, currentDateMoment and currentDateFormatted are getting set as below. currentDateM
I'm unable to mock moment() or moment().format functions. I have states where, currentDateMoment and currentDateFormatted are getting set as below. currentDateM
I wonder if there is a better way to disable console errors inside a specific Jest test (i.e., restore the original console before/after each test). Here is my
I have the following in my jest.config.js module.exports = { preset: 'ts-jest/presets/js-with-ts', testEnvironment: 'jsdom' }; but it's being ignored w
I type: npm test and I get: It's interesting to note that the import statement works inside the BootScene.test.js file but it doesn't work in the imported fil
I added tests to my node js project using jest but for each test suite there's a beforeAll method that creates a new test server and connects to a mongo databas
I need to assert that an array does not contain any of the elements of a second array. In other words, I need to assert that two arrays are disjoint. I have tri
The title pretty much explains what I'm facing. I'm trying to test a React component that has some state, and I attempt to provide my store to the component in
I am trying to test an Angular app with testing-library/angular@11 and [email protected] which uses custom-elements quite heavily. Unfortunately I am not quite sure i
My functions in Calculator class is private and I can't test in this way, describe('calculate', function() { it('add', function() { let result = Calculat
I am updating a project from jest version 26 to jest version 27. As part of the update I had to switch from assertions on setTimeout to assertions on jest.spyOn
Here is the code. I'm getting error TypeError: setSystemTime is not available when not using modern timers when I run the test. I have "@jest/fake-timers": "^27