Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
6 views

how can i resolve this problem and this my jest.config.js module.exports = { preset: 'react-native', "setupFilesAfterEnv": [ "@testing-library/jest-native/extend-expect" ]...
Hela slimen's user avatar
Tooling
0 votes
2 replies
47 views

I work on a NextJS project with Pages Router. We are using Jest for unit tests and Playwright for E2E. The application we are making is a funnel with several steps. Each step is a form with several ...
vtomic85's user avatar
  • 623
1 vote
1 answer
54 views

Problem Starting November 10th, my Jest integration tests began failing randomly with MongoDB connection errors. The tests use @testcontainers/mongodb v11.5.1 and mongodb v8.0.12. Error: ...
hiddenhenry's user avatar
-1 votes
0 answers
44 views

This is my parent component. import { useState } from 'react'; import VButton from 'ui-components/src/v2/VButton.jsx'; import { Provider } from 'ui-components/src/v2/providers/chakra.jsx'; import { ...
dariusz's user avatar
  • 593
0 votes
1 answer
50 views

In our tests, we had several snapshots that included content wrapped in next/head. We had previously followed the below pattern for the mock, which allowed us to see all the header tags like meta, ...
GotDibbs's user avatar
  • 3,157
-1 votes
0 answers
57 views

I want to mock transaction as PoolConnection jest.mock('../../src/config/db.js', () => ({ __esModule: true, default: { execute: jest.fn(), query: jest.fn(), ...
Agusta Pradnyana's user avatar
1 vote
0 answers
88 views

This is my unit test: import '@testing-library/jest-dom/extend-expect'; import { render, cleanup, fireEvent, waitFor, waitForElementToBeRemoved, screen, } from '@testing-library/svelte'; ...
dariusz's user avatar
  • 593
1 vote
1 answer
83 views

I am doing unit testing for my project. This is the code I want to test: import { create } from "zustand"; import { persist } from "zustand/middleware"; interface LanguageState { ...
Lollypop123445's user avatar
0 votes
1 answer
39 views

I have a TypeScript monorepo that uses jest, and has a globalSetup script configured at the root config (it starts a local database process that many of the tests use). Example Directory structure ...
jon without an h's user avatar
0 votes
1 answer
73 views

I am attempting to run a simple Jest test to render the App element. This is our App.test.tsx: test('render application', () => { render(<App />); } This is the error that is being ...
DHZA's user avatar
  • 7
0 votes
0 answers
40 views

I am building a Manifest V3 Chrome Extension using Firebase and testing it with Jest and Puppeteer. My manual testing works perfectly, but one specific automated test consistently fails with a 30-...
David Kessler's user avatar
0 votes
0 answers
38 views

I’m trying to add a custom method onto the Jest API inside a setup file (config.ts) configured via setupFilesAfterEnv. However, the jest object I mutate in the setup file is NOT the same reference as ...
PierBJX's user avatar
  • 2,412
0 votes
0 answers
428 views

Jest 30 uses JSDOM 26, which breaks my tests. I want to test if location.search was modified. Since JSDOM 21, it is not possible to mock location.search as easily as it used to be: // does not work ...
htho's user avatar
  • 1,892
0 votes
0 answers
85 views

I have an integration test that publishes a domain event to Google Cloud Pub/Sub (using the Pub/Sub emulator). Eventduspatcher.integration.test.ts passes but Jest prints: Jest did not exit one second ...
gonchan's user avatar
0 votes
0 answers
197 views

I'm running into some inconsistent behavior with Jest 30.x, specifically when parsing a jest.config.ts file that imports another TypeScript module, on Node.js 22.18+. My code uses ESM syntax for the ...
Christian Siqueira's user avatar
1 vote
0 answers
46 views

My question is related to Enabling Jest cache in CI servers but a bit more specific. We use Jest with cache enabled on a CI server running tests on multiple projects. By default, Jest uses /tmp/...
charlockfreefr's user avatar
0 votes
0 answers
63 views

I'm testing a Backstage plugin component that renders a list of Ansible components using the Backstage Table from @backstage/core-components. In my test, I mock the catalog API to return 2 entities (...
Pavan P Jangale's user avatar
1 vote
1 answer
55 views

Question I have a registerUser method that imports a hashPassword function from a local utility module. // registerUser.ts import { User } from "../models/user.model"; import { hashPassword }...
Rugved J's user avatar
0 votes
2 answers
125 views

I have a Next.js project with TypeScript. It's a page router instead of an app router No babel config file(.babelrc etc) in the project The error occurs when I run npm test. jost seems to be one of ...
User A's user avatar
  • 29
0 votes
0 answers
58 views

I'm experiencing frustrating Jest coverage inconsistencies in my React project. When I run tests for individual files in isolation, I get perfect 100% coverage as expected. However, when I run the ...
Ndx's user avatar
  • 647
0 votes
1 answer
73 views

nodejs: 24.7 jsdom: 26.1.0 Basically, I want to create a selector, that would exclude nested elements - it should find only elements at the first level of nesting. I have this: it('Test selector non-...
Łukasz Zaroda's user avatar
3 votes
0 answers
76 views

Im trying to configure an unit test for my website with Jest and I can't get it to work correctly. I've tried some of the solutions suggested by the ts-jest documentation but it still hasn't worked. ...
Samuel Augusto's user avatar
0 votes
1 answer
80 views

I have a component like this to test: import {doSomethingMocked} form 'mockedLibrary'; const TheComponent = (props) => { const [isToTest, setIsToTest] = useState(false); const handleClick = ...
Daniel Reinaldo Zorro Forero's user avatar
-3 votes
1 answer
81 views

Can you help me explain why this jest test case passes? import { describe, it, expect } from '@jest/globals'; ... describe('jest assertions', () => { it('2 should not equal 1', () => { ...
Jan Dolejsi's user avatar
  • 1,561
0 votes
1 answer
236 views

I'm writing unit tests for NX libraries and one service is driving me crazy. It injects generated services and calls their exposed methods. I'm using Jest + Spectator combination and I'm getting this ...
mat.hudak's user avatar
  • 3,306
1 vote
1 answer
51 views

In my snapshot, I have objects of the following format: { "meanElements": { "Om": 2.2835713400168607, "am": 1.3043985097733939, "em": 0.166565, ...
1valdis's user avatar
  • 1,144
0 votes
1 answer
60 views

I'm bumping into an issue importing a helper function, which calls Puppeteer methods, into a test file. I've created a simplified example of my problem. I have a test in a file called my-test.test.js: ...
Eric's user avatar
  • 1,685
0 votes
0 answers
76 views

I am beginning to add tests to my TypeScript web application using Jest. Some functions (or methods) use the SVG API and interact with the DOM. I installed: jest @types/jest jest-environment-jsdom, ...
zwoolli's user avatar
  • 311
-1 votes
1 answer
86 views

I'm aware of previous related problems with node12- & jsdom & textEncoder but now, trying to create a jest30+jsdom30 config file doing as little as: module.exports = { testEnvironment: '...
Daniel Reinaldo Zorro Forero's user avatar
0 votes
0 answers
47 views

Im trying to test an error state which get updated when no foundEnterprise match is found: async function onSubmit (data) { try { const enterprisesData = await fetchData() const ...
Oksana Dotsenko's user avatar
0 votes
0 answers
35 views

Our project structure looks like this: apps | ---api ---api-e2e with the e2e using @nx/jest for testing. I'm trying to generate the coverage for API, but haven't been able to do it successfully. I ...
jonianas's user avatar
2 votes
1 answer
428 views

Angular 19 : Extension of locales is .mjs in @angular/common/locales. Angular 20 : Extension of locales is .js in @angular/common/locales. Jest's default configuration ignores transformation of ...
isy's user avatar
  • 583
0 votes
0 answers
67 views

The test below is a contrived example intended to demonstrate the issue I'm encountering. I'm using Jest and Puppeteer to test a function called doSomething. The file containing the function (random....
Eric's user avatar
  • 1,685
0 votes
1 answer
69 views

I'm experiencing a persistent timeout issue with my Jest tests for an Express.js application using MongoDB Memory Server. The test appears to be successful (receiving a 200 status code) but Jest times ...
Daniel Oladepo's user avatar
-1 votes
2 answers
68 views

The task is to check if a certain date is a statutory holiday, by comparing a date against a list of known statutory holiday dates. Here is the JSON list of stat holidays: { "provinces": ...
coco's user avatar
  • 3,166
0 votes
0 answers
24 views

I have a guard factory that returns a new guard Type to be used with NestJS @UseGuard decorator. export function ParamValidationGuardFactory(opts: ParamValidationGuardOpts): Type<CanActivate> { ...
kamcknig's user avatar
  • 945
0 votes
1 answer
44 views

I have created an LWC in Salesforce and am trying to creat Jest tests for it. I have implemented a div in html file and calling the js function using the onclick event as shown below. <div class=&...
Ravi SFDC's user avatar
-1 votes
2 answers
69 views

I have a module (called myModule) which exports two classes (MyClass1 and MyClass2). I'm trying to mock a single class (MyClass1) from myModule using Jest, but I want the mock to preserve the ...
PierBJX's user avatar
  • 2,412
0 votes
1 answer
333 views

This is my spec folder, on Android everything is ok too, everything works normally. Then I use NativeModule normally on a page, but Jest keeps failing. import type { TurboModule } from "react-...
Gabriel Logan's user avatar
1 vote
2 answers
113 views

Angular: 18.2.13 Jest: 29.7.0 I'm unit testing a method in my component which performs a router.navigate after a successful HTTP call. Note that I've removed some of the unncessary code for brevity ...
commadelimited's user avatar
-1 votes
2 answers
582 views

I am new to Next.js but not to React and Jest; this is the first test suite I'm setting up in Next.js. I have the following (extremely minimal, but this example does cause the error) component I am ...
cdyswnnr's user avatar
0 votes
0 answers
189 views

Repo I am trying to setup Jest in my Turborepo monorepo specifically in my UI package. I'm trying to setup Jest so I have a very basic test to see how it works: Button.spec.tsx import {describe, it, ...
Ethan's user avatar
  • 1,868
1 vote
2 answers
124 views

I've got an Angular test suite which uses a MockActivatedRoute class I created. All of the values are null except when I need to set them for a given test. In general it works great, but now I'm in a ...
commadelimited's user avatar
0 votes
0 answers
48 views

I use the aws-amplify library to fetch oauth tokens. In productive code a signIn takes less than 1 second. When executing the same functionality in jest (v29), the sign in takes around 6 seconds which ...
Fabi's user avatar
  • 1
0 votes
0 answers
51 views

I'm writing unit tests for a Vue 3 component using the Composition API, Vue Test Utils, and Jest. The component has a method that triggers an API call and updates a step variable based on the result. ...
Neha Soni's user avatar
  • 4,762
2 votes
0 answers
57 views

I'm new to Expo and testing in general and want to write tests for _layout.tsx which looks as the following (actually it is just the default from the project setup with removed not-needed parts): ...
3li's user avatar
  • 21
0 votes
1 answer
199 views

I'm writing Jest tests for a React project that uses TypeScript. When I run the tests, I get the following error: ReferenceError: React is not defined I was able to get rid of this error by adding: ...
DushyanthaAT's user avatar
2 votes
1 answer
114 views

I'm working on a React component library that was bootstrapped initially with TSDX (v0.14.1). After upgrading React from 17 to 18 and Storybook from 6.5.16 to 7.6.20, all my Jest tests stopped working ...
Itay Tur's user avatar
  • 1,962
0 votes
1 answer
111 views

While running jest on a react native project I got this error: "invariant violation: native animated module is not available"
Mardok's user avatar
  • 1,460
0 votes
0 answers
44 views

I have implement a custom ESLint rule such that when we import packages from another package using absolute path e.g. import {something} from ../../libs/package2/subpackage in package1 then ESLint ...
Bharath Subu's user avatar

1
2 3 4 5
459