Skip to content

Tag: jestjs

Jest: shared async code between test blocks

I have some test code like this: I would like to break apart the code into multiple test blocks (because I can’t even add a description message to each expect statement). If Jest supported async describe, I could do this: I could duplicate the setup call for each test of course, but that would slow down…

Jest : ReferenceError: describe is not defined

I try to setup jest for my project following this tutorial : https://dev.to/nedsoft/testing-nodejs-express-api-with-jest-and-supertest-1km6 But when I try to run a basic test I’ve got the error below : I try to remove in my package.json : But nothing change. A idea ? Answer Ok the problem is last versio…

Start and stop server with supertest

I have the following server class : I’m using supertest for end-to-end testing. I wish to start my application beforeAll tests and stop it when the tests are done. It’s easy to do that using beforAll and afterAll where I can just once instanciate the Server class and call the start and close metho…

Get tests running time with Jest

Is there any way to know how long my tests take without doing it programmatically with Jest? To be clear, I know that if I add a variable to get the current time before each test and then log this when my test completes I’ll get this information, but I want this automatically, maybe with some Jest confi…

How to resolve “Animated: `useNativeDriver` is not supported because the native animated module is missing.” in react-navigation?

I am working on expo SDK Version: 36, and on all platforms (ios/android/web) When installing react-navigation for the first time as described in the documentation and running jest –watch while doing it, and the following warning appeared: It also happen in the browser console: Related issues: https://gi…

How to test es6 default values in jest

How do you test the given default parameter value in jest? An example having the module: Or abit more complicated function module. Answer Each expected result of the test case is specified by us, that is, we have set the expected result in advance, whether the result actually returned by the test code is cons…