Category "ts-jest"

Jest test stuck on bitbucket pipelines without any error

We use Bitbucket pipelines in our CI for testing, Our application is NestJS with Typescript tested with Jest. We always got all tests running, however few days

Setting Bearer Token in the header section while testing with Supertest

I'm trying to add the Bearer in the header section in POST request while testing with Supertest. I tried many methods. I'm a beginner in testing. Please suggest

Uncaught TypeError: Cannot read properties of undefined (reading 'isBatchingLegacy')

I am trying to test a react typescript project using jest but it's giving a confusing error: Error image Here is my package.json: "dependencies": { "@testin

Cannot find memory leak in my Express.js Jest tests

I've now spent some time trying to find memory leaks in my Jest tests, and even though I've successfully tackled some, there's still quite a lot of memory being

How to strongly type jest mocks

I would like to strongly type my jest mocks. To a certain extent, I can make it work but when a class has private properties I'm stuck. An additional question,

How to pass in the done() parameter on an async jest test.each case

I'm trying write a jest test case that tests an async method, I want to pass in the done() parameter so jest waits for it to be fired before it ends the test, h

How to mock and check that a function from a library in Jest framework?

I have a button with "Download" text on it defined in ReactJS code. Now, I want to write a unit test to check that this function is getting called when this but

Mock OpenSearch Client in jest unit test

I'm trying to mock out the opensearch client for testing purposes and am running into an error. My app is using OpenSearch (@opensearch-project/opensearch) and

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 to check whether the test runs. When I run the test u

How do I mock AWS S3 GetObjectCommand with jest using the v3 sdk?

Testing an s3 upload? The method to test is export class ProcessData { constructor() {} async process(): Promise<void> { const data = await s3Cl

How to set up Jest w/ESM to recognize non-cjs modules in node_modules

Have got a successful jest/esm setup, however occasionally a module is released that specifies both a main key (for commonjs) and a module key (for ESM) in its

How to create nested moduleNameMapper in Jest?

My simplified jest.config.js is: module.exports = { preset: "ts-jest", collectCoverage: true, collectCoverageFrom: [ "src/**/*.ts", "!**/node_mod

Typescript paths not resolving when running jest?

Attempting to convert this project over to jest using these instructions. I have everything working except for the files that use the paths configuration: "pa