Category "jestjs"

Jest obsolete snapshot warning causes test failure: ignore warnings when exiting Jest

I have a test suite/file that I have disabled. It has an associated snapshot file. For my particular situation I do not want to delete or update the snapshot fi

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

jest-haste-map: Haste module naming collision (AWS, RN)

I have a React-native project with AWS Amplify. In the root directory, there is an amplify folder. Inside this amplify folder, there is a backend folder, an

jest-haste-map: Haste module naming collision (AWS, RN)

I have a React-native project with AWS Amplify. In the root directory, there is an amplify folder. Inside this amplify folder, there is a backend folder, an

Jest not implemented for window.open

Jest not implemented for window.open, getting error on the console but unit test is getting pass with console error a.ts file myFun(){ window.open('https://

Jest not implemented for window.open

Jest not implemented for window.open, getting error on the console but unit test is getting pass with console error a.ts file myFun(){ window.open('https://

Jest test for a copy to clipboard method using react with typescript

I am trying to ensure that the right value is copied to the users clipboard when they click a button. This is my copy method. I am using a ref on the input to a

React Jest:- node:internal/process/promises:246 triggerUncaughtException(err, true /* fromPromise */);

I have below code in react. useEffect(() => { (async () => { await httpClient .get(`${config.resourceServerUrl}/invent

Jest TestEnvironment - TypeError: Cannot add property next, object is not extensible

I want to test a node API using Jest. I am testing the routes and websockets. Testing the routes was no problem. I simply started the server using the setupFile

jest is failing to find `bota` and `atob`

Creating a jest test like: test("btoa", () => { expect(btoa("aaa")).toStrictEqual("YWFh"); }); fails with ReferenceError: btoa is not defined however, no

Running jest tests in parallel based on a list of parameters

In my case I have a test file containing a few hundred tests using jest describe('my test-suite', () => { test('test 1', () => { expect(1).toBe(

jest test case for URLSearchParams

search looks like this search: "?productId=1234" and changeId is action const urlParams = new URLSearchParams(window.location.search); const productId = urlP

Jest Call retries were exceeded

I have error in the following below test. My node version is : v12.10.0. is there any alternative of setTimeout? test('demo code', async () => {

Focus event unit test doesn't works in Vuejs / Jest

I want to create a unit test for two events, on focus and on blur. I am using vueJS and jest. handleFocus(event) { if (this.blured === true)

(Apollo client v3) useLazyQuery custom hook testing

I was struggling with a test issue for my custom useLazyQuery hook. My first test is passing but the second one is failing. What am doing wrong for the second t

How can I use jest to spyOn an internal function?

2 questions in 1 here. Why do I get an error message for my jest.spyOn saying that createMappingsDirectory is not a function? Secondly, I think where I’ve

How to mock axios.create([config]) function to return its instance methods instead of overriding them with mock?

I'm trying to mock axios.create() because I'm using its instance across the app and obviously need all of its implementation which is destroyed by the mock, thu

How to unit test typeorm getRepository with Jest?

I am using typescript with typeorm and i have an repository like this: import { EntityRepository, getRepository, createQueryBuilder } from 'typeorm'; @EntityR

Jest: test that an array contains none of these values?

I want to verify that a given array doesn't contain any of a list of values. There is expect.arrayContaining but I don't get how it is supposed to be used for t

How to add module aliases to Jest testing in Next.js?

Currently I am using automatic imports in my Next.js project, configured by jsconfig.json in the root directory: { "typeAcquisition": { "include": ["jest"